From 3d4745385602429db1308f09fd4328f2624ce973 Mon Sep 17 00:00:00 2001 From: riemann Date: Mon, 6 Oct 2025 12:14:45 +0300 Subject: [PATCH 01/70] feat: init p2ide note example --- examples/p2ide-note/.gitignore | 1 + examples/p2ide-note/Cargo.lock | 2063 +++++++++++++++++ examples/p2ide-note/Cargo.toml | 37 + examples/p2ide-note/cargo-generate.toml | 2 + examples/p2ide-note/rust-toolchain.toml | 5 + examples/p2ide-note/src/lib.rs | 79 + examples/p2ide-note/wit/.gitkeep | 0 .../src/node_tests/basic_wallet.rs | 199 ++ 8 files changed, 2386 insertions(+) create mode 100644 examples/p2ide-note/.gitignore create mode 100644 examples/p2ide-note/Cargo.lock create mode 100644 examples/p2ide-note/Cargo.toml create mode 100644 examples/p2ide-note/cargo-generate.toml create mode 100644 examples/p2ide-note/rust-toolchain.toml create mode 100644 examples/p2ide-note/src/lib.rs create mode 100644 examples/p2ide-note/wit/.gitkeep diff --git a/examples/p2ide-note/.gitignore b/examples/p2ide-note/.gitignore new file mode 100644 index 000000000..c41cc9e35 --- /dev/null +++ b/examples/p2ide-note/.gitignore @@ -0,0 +1 @@ +/target \ No newline at end of file diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock new file mode 100644 index 000000000..5f7354625 --- /dev/null +++ b/examples/p2ide-note/Cargo.lock @@ -0,0 +1,2063 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[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 = "bech32" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" + +[[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.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "blake3" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "cc" +version = "1.2.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dissimilar" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d18470a76cb7f8ff746cf1f7470914f900252ec36bbc40b569d74b1258446827" +dependencies = [ + "cc", + "cfg-if", + "libc", + "log", + "rustversion", + "windows", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +dependencies = [ + "foldhash", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[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.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[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", + "regex", + "regex-syntax 0.8.5", + "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.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[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.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "miden" +version = "0.5.0" +dependencies = [ + "miden-base", + "miden-base-sys", + "miden-sdk-alloc", + "miden-stdlib-sys", + "wit-bindgen", +] + +[[package]] +name = "miden-air" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +dependencies = [ + "miden-core", + "thiserror", + "winter-air", + "winter-prover", +] + +[[package]] +name = "miden-assembly" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +dependencies = [ + "log", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", + "smallvec", + "thiserror", +] + +[[package]] +name = "miden-assembly-syntax" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +dependencies = [ + "aho-corasick", + "lalrpop", + "lalrpop-util", + "log", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "midenc-hir-type", + "regex", + "rustc_version 0.4.1", + "semver 1.0.26", + "smallvec", + "thiserror", +] + +[[package]] +name = "miden-base" +version = "0.5.0" +dependencies = [ + "miden-base-macros", + "miden-base-sys", + "miden-stdlib-sys", +] + +[[package]] +name = "miden-base-macros" +version = "0.5.0" +dependencies = [ + "miden-objects", + "proc-macro2", + "quote", + "semver 1.0.26", + "syn", + "toml 0.8.23", +] + +[[package]] +name = "miden-base-sys" +version = "0.5.0" +dependencies = [ + "miden-stdlib-sys", +] + +[[package]] +name = "miden-core" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +dependencies = [ + "miden-crypto", + "miden-debug-types", + "miden-formatting", + "num-derive", + "num-traits", + "thiserror", + "winter-math", + "winter-utils", +] + +[[package]] +name = "miden-crypto" +version = "0.15.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +dependencies = [ + "blake3", + "glob", + "num", + "num-complex", + "rand", + "rand_core", + "sha3", + "thiserror", + "winter-crypto", + "winter-math", + "winter-utils", +] + +[[package]] +name = "miden-debug-types" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +dependencies = [ + "memchr", + "miden-crypto", + "miden-formatting", + "miden-miette", + "miden-utils-sync", + "paste", + "thiserror", +] + +[[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.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +dependencies = [ + "derive_more", + "miden-assembly-syntax", + "miden-core", +] + +[[package]] +name = "miden-miette" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" +dependencies = [ + "cfg-if", + "futures", + "indenter", + "lazy_static", + "miden-miette-derive", + "owo-colors", + "regex", + "rustc_version 0.2.3", + "rustversion", + "serde_json", + "spin", + "strip-ansi-escapes", + "syn", + "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", +] + +[[package]] +name = "miden-objects" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +dependencies = [ + "bech32", + "getrandom", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "miden-verifier", + "semver 1.0.26", + "thiserror", +] + +[[package]] +name = "miden-processor" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +dependencies = [ + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "thiserror", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-sdk-alloc" +version = "0.5.0" + +[[package]] +name = "miden-stdlib-sys" +version = "0.5.0" + +[[package]] +name = "miden-utils-diagnostics" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +dependencies = [ + "miden-crypto", + "miden-debug-types", + "miden-miette", + "paste", + "tracing", +] + +[[package]] +name = "miden-utils-sync" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +dependencies = [ + "lock_api", + "loom", +] + +[[package]] +name = "miden-verifier" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +dependencies = [ + "miden-air", + "miden-core", + "thiserror", + "tracing", + "winter-verifier", +] + +[[package]] +name = "midenc-hir-type" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +dependencies = [ + "miden-formatting", + "smallvec", + "thiserror", +] + +[[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.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[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-derive" +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 = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" + +[[package]] +name = "p2ide" +version = "0.1.0" +dependencies = [ + "miden", +] + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "petgraph" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" +dependencies = [ + "fixedbitset", + "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 = "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", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +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 = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + +[[package]] +name = "redox_syscall" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3a5d9f0aba1dbcec1cc47f0ff94a4b778fe55bca98a6dfa92e4e094e57b1c4" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.9", + "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", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +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" + +[[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.26", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[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 = "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.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +dependencies = [ + "serde", +] + +[[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.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.141" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" +dependencies = [ + "serde", +] + +[[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 = "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" + +[[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" + +[[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 = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "target-triple" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790" + +[[package]] +name = "term" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[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.1", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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 = "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", +] + +[[package]] +name = "toml" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac" +dependencies = [ + "indexmap", + "serde", + "serde_spanned 1.0.0", + "toml_datetime 0.7.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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" +dependencies = [ + "serde", +] + +[[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_parser" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97200572db069e74c512a14117b296ba0a80a30123fbbb5aa1f4a348f639ca30" +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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "trybuild" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65af40ad689f2527aebbd37a0a816aea88ff5f774ceabe99de5be02f2f91dae2" +dependencies = [ + "dissimilar", + "glob", + "serde", + "serde_derive", + "serde_json", + "target-triple", + "termcolor", + "toml 0.9.2", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[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.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +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", +] + +[[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", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +dependencies = [ + "bitflags", + "hashbrown", + "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", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[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_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link", +] + +[[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.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[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.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[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.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[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.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" +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", +] + +[[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-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 = "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-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-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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a4232e841089fa5f3c4fc732a92e1c74e1a3958db3b12f1de5934da2027f1f4" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "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", + "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", + "wasm-metadata", + "wasmparser", + "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.26", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] diff --git a/examples/p2ide-note/Cargo.toml b/examples/p2ide-note/Cargo.toml new file mode 100644 index 000000000..78191560a --- /dev/null +++ b/examples/p2ide-note/Cargo.toml @@ -0,0 +1,37 @@ +cargo-features = ["trim-paths"] + +[package] +name = "p2ide" +version = "0.1.0" +edition = "2021" + +[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 SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) +# and transaction kernel API for the Miden rollup +miden = { path = "../../sdk/sdk" } + +[package.metadata.component] +package = "miden:p2ide" + +[package.metadata.miden] +project-kind = "note-script" + +# Miden dependencies for cargo-miden build/linking +[package.metadata.miden.dependencies] +"miden:basic-wallet" = { path = "../basic-wallet" } + + +[package.metadata.component.target.dependencies] +"miden:base" = { path = "../../sdk/base/wit/miden.wit" } +"miden:basic-wallet" = { path = "../basic-wallet/wit/basic-wallet.wit" } + +[profile.release] +trim-paths = ["diagnostics", "object"] + +[profile.dev] +trim-paths = ["diagnostics", "object"] diff --git a/examples/p2ide-note/cargo-generate.toml b/examples/p2ide-note/cargo-generate.toml new file mode 100644 index 000000000..26029f3e7 --- /dev/null +++ b/examples/p2ide-note/cargo-generate.toml @@ -0,0 +1,2 @@ +[template] +ignore = ["target"] diff --git a/examples/p2ide-note/rust-toolchain.toml b/examples/p2ide-note/rust-toolchain.toml new file mode 100644 index 000000000..dd49b3008 --- /dev/null +++ b/examples/p2ide-note/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2025-07-20" +components = ["rustfmt", "rust-src", "clippy"] +targets = ["wasm32-wasip2"] +profile = "minimal" diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs new file mode 100644 index 000000000..2ce131824 --- /dev/null +++ b/examples/p2ide-note/src/lib.rs @@ -0,0 +1,79 @@ +// Do not link against libstd (i.e. anything defined in `std::`) +#![no_std] + +// 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; + +// Global allocator to use heap memory in no-std environment +#[global_allocator] +static ALLOC: miden::BumpAlloc = miden::BumpAlloc::new(); + +// Required for no-std crates +#[cfg(not(test))] +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} + +use miden::*; + +use crate::bindings::miden::basic_wallet::basic_wallet::receive_asset; + +fn consume_assets() { + let assets = note::get_assets(); + for asset in assets { + receive_asset(asset); + } +} + +fn reclaim_assets(consuming_account: AccountId) { + let creator_account = note::get_sender(); + + let is_creator = creator_account.prefix == consuming_account.prefix + && creator_account.suffix == consuming_account.suffix; + + if is_creator { + consume_assets(); + } else { + panic!(); + } +} + +#[note_script] +fn run(_arg: Word) { + let inputs = note::get_inputs(); + let target_account_id_prefix = inputs[0]; + let target_account_id_suffix = inputs[1]; + let timelock_height = inputs[2]; + let reclaim_height = inputs[3]; + + // make sure the number of inputs is 4 + // assert_eq(inputs.len().into(), Felt::from(4u32)); + + // sanity check + // assert_eq(timelock_height, Felt::from(1000u32)); + // assert_eq(reclaim_height, Felt::from(1010u32)); + + // get block number + let block_number = tx::get_block_number(); + + assert!(block_number >= timelock_height); + + // get consuming account id + let consuming_account_id = account::get_id(); + + // if consuming account is target, claim assets + // if consuming account is creator account, claim assets + // else panic + let is_target = consuming_account_id.prefix == target_account_id_prefix + && consuming_account_id.suffix == target_account_id_suffix; + + if is_target { + consume_assets(); + } else { + reclaim_assets(consuming_account_id); + } +} diff --git a/examples/p2ide-note/wit/.gitkeep b/examples/p2ide-note/wit/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index 5cc267108..c5c7c4ac0 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -199,3 +199,202 @@ pub fn test_basic_wallet_p2id_local() { .await; }); } + +/// Tests the basic-wallet contract deployment and p2ide note consumption workflow on a local node. +#[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 note_package = compile_rust_package("../../examples/p2ide-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_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"); + + // 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(); + + // p2ide inputs + let timelock_height = 1000u32; + let reclaim_height = 1010u32; + + // Create the p2ide note from faucet to Alice + let p2ide_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(), + timelock_height.into(), + reclaim_height.into(), + ], + ..Default::default() + }, + ); + eprintln!("P2IDE mint note hash: {:?}", p2ide_note_mint.id().to_hex()); + + let mint_request = TransactionRequestBuilder::new() + .own_output_notes(vec![OutputNote::Full(p2ide_note_mint.clone())]) + .build() + .unwrap(); + + let mint_tx_result = + client.new_transaction(faucet_account.id(), mint_request).await.unwrap(); + let mint_tx_id = mint_tx_result.executed_transaction().id(); + eprintln!("Created mint transaction. Tx ID: {mint_tx_id:?}"); + + client.submit_transaction(mint_tx_result).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([(p2ide_note_mint, None)]) + .build() + .unwrap(); + + let consume_tx = client + .new_transaction(alice_account.id(), consume_request) + .await + .map_err(|e| format!("{e:?}")) + .unwrap(); + + client.submit_transaction(consume_tx).await.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 p2ide 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 p2ide transaction. Tx ID: {alice_tx_id:?}"); + + // Step 5: Bob attempts to consume the p2ide note + eprintln!("\n=== Step 5: Bob attempts to consume p2ide note ==="); + + let consume_request = TransactionRequestBuilder::new() + .unauthenticated_input_notes([(bob_note, None)]) + .build() + .unwrap(); + + let consume_tx = client.new_transaction(bob_account.id(), consume_request).await.unwrap(); + let consume_tx_id = consume_tx.executed_transaction().id(); + eprintln!("Bob created consume transaction. Tx ID: {consume_tx_id:?}"); + + client.submit_transaction(consume_tx).await.unwrap(); + + 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; + }); +} From 9386861c3430adc7bdc814712f713b54bf6948e8 Mon Sep 17 00:00:00 2001 From: riemann Date: Thu, 9 Oct 2025 13:27:23 +0300 Subject: [PATCH 02/70] wip --- Cargo.toml | 61 ++++++++++++++++++++++++++++++++++ examples/p2ide-note/src/lib.rs | 21 ++++++------ 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 051ed44c8..4d9b0c018 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -180,6 +180,67 @@ opt-level = 3 [profile.test.package.rand_chacha] opt-level = 3 +# Speed up the test profile (proving times) +# ============================================================ +# The test package itself needs optimization +[profile.test.package.miden-integration-node-tests] +opt-level = 3 + +# Core Miden packages +[profile.test.package.miden-processor] +opt-level = 3 + +[profile.test.package.miden-prover] +opt-level = 3 + +[profile.test.package.winter-prover] +opt-level = 3 + +[profile.test.package.miden-client] +opt-level = 3 + +[profile.test.package.miden-lib] +opt-level = 3 + +[profile.test.package.miden-tx] +opt-level = 3 + +# Additional crypto and math-heavy dependencies +[profile.test.package.miden-crypto] +opt-level = 3 + +[profile.test.package.winter-crypto] +opt-level = 3 + +[profile.test.package.winter-air] +opt-level = 3 + +[profile.test.package.winter-math] +opt-level = 3 + +[profile.test.package.miden-objects] +opt-level = 3 + +[profile.test.package.miden-core] +opt-level = 3 + +[profile.test.package.miden-assembly] +opt-level = 3 + +[profile.test.package.miden-stdlib] +opt-level = 3 + +# Compiler packages that might be used in tests +[profile.test.package.midenc-frontend-wasm] +opt-level = 3 + +[profile.test.package.midenc-session] +opt-level = 3 + +[profile.test.package.midenc-debug] +opt-level = 3 +# ============================================================ + [profile.dev.package.dissimilar] opt-level = 3 diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index 2ce131824..460038c81 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -32,10 +32,7 @@ fn consume_assets() { fn reclaim_assets(consuming_account: AccountId) { let creator_account = note::get_sender(); - let is_creator = creator_account.prefix == consuming_account.prefix - && creator_account.suffix == consuming_account.suffix; - - if is_creator { + if consuming_account == creator_account { consume_assets(); } else { panic!(); @@ -47,8 +44,8 @@ fn run(_arg: Word) { let inputs = note::get_inputs(); let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; - let timelock_height = inputs[2]; - let reclaim_height = inputs[3]; + // let timelock_height = inputs[2]; + // let reclaim_height = inputs[3]; // make sure the number of inputs is 4 // assert_eq(inputs.len().into(), Felt::from(4u32)); @@ -58,22 +55,24 @@ fn run(_arg: Word) { // assert_eq(reclaim_height, Felt::from(1010u32)); // get block number - let block_number = tx::get_block_number(); + // let block_number = tx::get_block_number(); - assert!(block_number >= timelock_height); + // assert!(block_number >= timelock_height); // get consuming account id - let consuming_account_id = account::get_id(); + // let consuming_account_id = account::get_id(); + + consume_assets(); // if consuming account is target, claim assets // if consuming account is creator account, claim assets // else panic - let is_target = consuming_account_id.prefix == target_account_id_prefix +/* let is_target = consuming_account_id.prefix == target_account_id_prefix && consuming_account_id.suffix == target_account_id_suffix; if is_target { consume_assets(); } else { reclaim_assets(consuming_account_id); - } + } */ } From 89857862faf9f02a14e9877fc5d15fa12d2d7d46 Mon Sep 17 00:00:00 2001 From: riemann Date: Fri, 10 Oct 2025 13:12:11 +0300 Subject: [PATCH 03/70] feat: demonstrate failure via note inputs --- examples/p2ide-note/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index 460038c81..156283698 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -44,11 +44,13 @@ fn run(_arg: Word) { let inputs = note::get_inputs(); let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; - // let timelock_height = inputs[2]; + + let timelock_height = inputs[2]; // fails when uncommented + // let reclaim_height = inputs[3]; // make sure the number of inputs is 4 - // assert_eq(inputs.len().into(), Felt::from(4u32)); + // assert_eq(inputs.len().into(), Felt::from(2u32)); // sanity check // assert_eq(timelock_height, Felt::from(1000u32)); @@ -67,7 +69,8 @@ fn run(_arg: Word) { // if consuming account is target, claim assets // if consuming account is creator account, claim assets // else panic -/* let is_target = consuming_account_id.prefix == target_account_id_prefix + /* + let is_target = consuming_account_id.prefix == target_account_id_prefix && consuming_account_id.suffix == target_account_id_suffix; if is_target { From 8b0ffc9eb6c745aff5a819aabd77052fc69ad6d8 Mon Sep 17 00:00:00 2001 From: riemann Date: Mon, 27 Oct 2025 16:20:16 +0300 Subject: [PATCH 04/70] feat: working P2IDE note --- examples/p2ide-note/Cargo.lock | 12 +-- examples/p2ide-note/Cargo.toml | 1 - examples/p2ide-note/src/lib.rs | 32 +++--- .../src/node_tests/basic_wallet.rs | 99 ++++++++++--------- 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index 5f7354625..170cbf443 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -485,7 +485,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.5.0" +version = "0.6.0" dependencies = [ "miden-base", "miden-base-sys", @@ -543,7 +543,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.5.0" +version = "0.6.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -552,7 +552,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.5.0" +version = "0.6.0" dependencies = [ "miden-objects", "proc-macro2", @@ -564,7 +564,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.5.0" +version = "0.6.0" dependencies = [ "miden-stdlib-sys", ] @@ -710,11 +710,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.5.0" +version = "0.6.0" [[package]] name = "miden-stdlib-sys" -version = "0.5.0" +version = "0.6.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/p2ide-note/Cargo.toml b/examples/p2ide-note/Cargo.toml index 78191560a..186d54376 100644 --- a/examples/p2ide-note/Cargo.toml +++ b/examples/p2ide-note/Cargo.toml @@ -27,7 +27,6 @@ project-kind = "note-script" [package.metadata.component.target.dependencies] -"miden:base" = { path = "../../sdk/base/wit/miden.wit" } "miden:basic-wallet" = { path = "../basic-wallet/wit/basic-wallet.wit" } [profile.release] diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index 156283698..9a8366022 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -45,37 +45,27 @@ fn run(_arg: Word) { let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; - let timelock_height = inputs[2]; // fails when uncommented - - // let reclaim_height = inputs[3]; + let timelock_height = inputs[2]; + let reclaim_height = inputs[3]; // make sure the number of inputs is 4 - // assert_eq(inputs.len().into(), Felt::from(2u32)); - - // sanity check - // assert_eq(timelock_height, Felt::from(1000u32)); - // assert_eq(reclaim_height, Felt::from(1010u32)); + assert_eq(inputs.len().into(), Felt::from(4u32)); // get block number - // let block_number = tx::get_block_number(); - - // assert!(block_number >= timelock_height); + let block_number = tx::get_block_number(); + assert!(block_number >= timelock_height); // get consuming account id - // let consuming_account_id = account::get_id(); + let consuming_account_id = account::get_id(); - consume_assets(); - - // if consuming account is target, claim assets - // if consuming account is creator account, claim assets - // else panic - /* - let is_target = consuming_account_id.prefix == target_account_id_prefix - && consuming_account_id.suffix == target_account_id_suffix; + // target account id + let target_account_id = AccountId::from(target_account_id_prefix, target_account_id_suffix); + let is_target = target_account_id == consuming_account_id; if is_target { consume_assets(); } else { + assert!(reclaim_height >= block_number); reclaim_assets(consuming_account_id); - } */ + } } diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index c5c7c4ac0..555eb0cb0 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -201,11 +201,13 @@ pub fn test_basic_wallet_p2id_local() { } /// Tests the basic-wallet contract deployment and p2ide note consumption workflow on a local node. +/// This is a simplified test demonstrating P2IDE note functionality without timelock/reclaim. #[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 note_package = compile_rust_package("../../examples/p2ide-note", true); + let p2id_note_package = compile_rust_package("../../examples/p2id-note", true); + let p2ide_note_package = compile_rust_package("../../examples/p2ide-note", true); let tx_script_package = compile_rust_package("../../examples/basic-wallet-tx-script", true); let rt = tokio::runtime::Runtime::new().unwrap(); @@ -223,12 +225,8 @@ pub fn test_basic_wallet_p2ide_local() { .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 + // 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 @@ -247,7 +245,7 @@ pub fn test_basic_wallet_p2ide_local() { // Create Alice's account with basic-wallet component let alice_config = AccountCreationConfig { - with_basic_wallet: false, + with_basic_wallet: true, ..Default::default() }; let alice_account = create_account_with_component( @@ -260,35 +258,27 @@ pub fn test_basic_wallet_p2ide_local() { .unwrap(); eprintln!("Alice account ID: {:?}", alice_account.id().to_hex()); - eprintln!("\n=== Step 1: Minting tokens from faucet to Alice ==="); + // 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(); - // p2ide inputs - let timelock_height = 1000u32; - let reclaim_height = 1010u32; - - // Create the p2ide note from faucet to Alice - let p2ide_note_mint = create_note_from_package( + // Create the p2id note from faucet to Alice + let p2id_note_mint = create_note_from_package( &mut client, - note_package.clone(), + 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(), - timelock_height.into(), - reclaim_height.into(), - ], + inputs: vec![alice_account.id().prefix().as_felt(), alice_account.id().suffix()], ..Default::default() }, ); - eprintln!("P2IDE mint note hash: {:?}", p2ide_note_mint.id().to_hex()); + eprintln!("P2ID mint note hash: {:?}", p2id_note_mint.id().to_hex()); let mint_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(p2ide_note_mint.clone())]) + .own_output_notes(vec![OutputNote::Full(p2id_note_mint.clone())]) .build() .unwrap(); @@ -300,10 +290,11 @@ pub fn test_basic_wallet_p2ide_local() { client.submit_transaction(mint_tx_result).await.unwrap(); eprintln!("Submitted mint transaction. Tx ID: {mint_tx_id:?}"); - eprintln!("\n=== Step 2: Alice attempts to consume mint note ==="); + // Step 3: Alice consumes the p2id note + eprintln!("\n=== Step 3: Alice consumes p2id mint note ==="); let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(p2ide_note_mint, None)]) + .unauthenticated_input_notes([(p2id_note_mint, None)]) .build() .unwrap(); @@ -325,7 +316,8 @@ pub fn test_basic_wallet_p2ide_local() { ) .await; - eprintln!("\n=== Step 3: Creating Bob's account ==="); + // Create Bob's account + eprintln!("\n=== Creating Bob's account ==="); let bob_config = AccountCreationConfig { with_basic_wallet: false, @@ -341,30 +333,52 @@ pub fn test_basic_wallet_p2ide_local() { .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 (alice_tx_id, bob_note) = send_asset_to_account( + let timelock_height = Felt::new(0); + let reclaim_height = Felt::new(0); + + // Create the p2ide note with only 2 inputs (account ID) + // This is a simplified P2IDE note without timelock/reclaim functionality + let p2ide_note = create_note_from_package( &mut client, + p2ide_note_package.clone(), alice_account.id(), - bob_account.id(), - transfer_asset, - note_package.clone(), - tx_script_package, - None, // Use default configuration - ) - .await - .unwrap(); + 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 transfer_tx_result = + client.new_transaction(alice_account.id(), transfer_request).await.unwrap(); + let alice_tx_id = transfer_tx_result.executed_transaction().id(); eprintln!("Alice created p2ide transaction. Tx ID: {alice_tx_id:?}"); - // Step 5: Bob attempts to consume the p2ide note - eprintln!("\n=== Step 5: Bob attempts to consume p2ide note ==="); + client.submit_transaction(transfer_tx_result).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([(bob_note, None)]) + .unauthenticated_input_notes([(p2ide_note, None)]) .build() .unwrap(); @@ -374,7 +388,7 @@ pub fn test_basic_wallet_p2ide_local() { client.submit_transaction(consume_tx).await.unwrap(); - eprintln!("\n=== Step 6: Checking Bob's account has the transferred asset ==="); + eprintln!("\n=== Checking Bob's account has the transferred asset ==="); assert_account_has_fungible_asset( &mut client, @@ -384,10 +398,7 @@ pub fn test_basic_wallet_p2ide_local() { ) .await; - eprintln!( - "\n=== Step 7: Checking Alice's account reflects the new token amount after sending \ - to Bob ===" - ); + eprintln!("\n=== Checking Alice's account reflects the new token amount ==="); assert_account_has_fungible_asset( &mut client, From 3015452d7583315814f4b360bd3601b8f7d21bde Mon Sep 17 00:00:00 2001 From: riemann Date: Mon, 27 Oct 2025 16:37:33 +0300 Subject: [PATCH 05/70] fix: clippy warning --- tests/integration-node/src/node_tests/basic_wallet.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index 555eb0cb0..ca5f71401 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -208,7 +208,6 @@ pub fn test_basic_wallet_p2ide_local() { 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 tx_script_package = compile_rust_package("../../examples/basic-wallet-tx-script", true); let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async { From 1ee295f1262e65c8fc9d4e62729f80b1770ced21 Mon Sep 17 00:00:00 2001 From: crStiv Date: Tue, 4 Nov 2025 13:31:02 +0100 Subject: [PATCH 06/70] Update new_project.rs --- tools/cargo-miden/src/commands/new_project.rs | 113 +++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index 5be0e8a36..28c24a786 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -1,11 +1,12 @@ use std::{ - fmt, + fmt, fs, path::{Path, PathBuf}, }; use anyhow::Context; use cargo_generate::{GenerateArgs, TemplatePath}; use clap::Args; +use toml_edit::{DocumentMut, Item, Value}; /// The tag used in checkout of the new project template. /// @@ -238,6 +239,18 @@ impl NewCommand { let _project_path = cargo_generate::generate(generate_args) .context("Failed to scaffold new Miden project from the template")?; + // Try to add the new crate to workspace Cargo.toml if one exists + use path_absolutize::Absolutize; + let project_path_abs = self + .path + .absolutize() + .context("Failed to convert project path to absolute path")? + .to_path_buf(); + if let Err(e) = add_to_workspace_if_exists(&project_path_abs) { + // Log warning but don't fail the command if workspace update fails + eprintln!("Warning: Failed to add crate to workspace: {e}"); + } + Ok(self.path) } } @@ -257,3 +270,101 @@ fn is_inside_git_repo(path: &Path) -> bool { } false } + +/// Finds a workspace Cargo.toml by walking up the directory tree from the given path. +/// +/// Returns the path to the workspace Cargo.toml if found, or None if not found. +fn find_workspace_cargo_toml(start_path: &Path) -> Option { + // Start from the parent directory of the new project (where it was created) + let start = start_path.parent()?; + + // Walk up the directory tree + for ancestor in start.ancestors() { + let cargo_toml = ancestor.join("Cargo.toml"); + if cargo_toml.exists() { + // Check if it's a workspace by reading and parsing it + if let Ok(content) = fs::read_to_string(&cargo_toml) { + if content.contains("[workspace]") { + return Some(cargo_toml); + } + } + } + } + None +} + +/// Adds a new crate to the workspace Cargo.toml if one exists. +/// +/// The member path is relative to the workspace root. +fn add_to_workspace_if_exists(project_path: &Path) -> anyhow::Result<()> { + let workspace_cargo_toml = match find_workspace_cargo_toml(project_path) { + Some(path) => path, + None => { + // No workspace found, nothing to do + return Ok(()); + } + }; + + // Read the workspace Cargo.toml + let content = + fs::read_to_string(&workspace_cargo_toml).context("Failed to read workspace Cargo.toml")?; + + // Parse the TOML document + let mut doc = content.parse::().context("Failed to parse workspace Cargo.toml")?; + + // Get the workspace root directory + let workspace_root = workspace_cargo_toml + .parent() + .ok_or_else(|| anyhow::anyhow!("Workspace Cargo.toml has no parent directory"))?; + + // Calculate the relative path from workspace root to the new project + let member_path = project_path + .strip_prefix(workspace_root) + .context("Failed to calculate relative path from workspace root to project")? + .to_str() + .ok_or_else(|| anyhow::anyhow!("Project path contains invalid UTF-8"))? + .to_string(); + + // Ensure the workspace section exists + if !doc.contains_key("workspace") { + doc.insert("workspace", Item::Table(toml_edit::Table::new())); + } + + let workspace = doc["workspace"] + .as_table_mut() + .ok_or_else(|| anyhow::anyhow!("Workspace section is not a table"))?; + + // Get or create the members array + let members = if workspace.contains_key("members") { + workspace["members"] + .as_array_mut() + .ok_or_else(|| anyhow::anyhow!("Workspace members is not an array"))? + } else { + let members_array = toml_edit::Array::new(); + workspace.insert("members", Item::Value(Value::Array(members_array))); + workspace["members"] + .as_array_mut() + .ok_or_else(|| anyhow::anyhow!("Failed to create members array"))? + }; + + // Check if the member is already in the list + let member_path_str = member_path.as_str(); + let already_exists = members.iter().any(|item| { + if let Some(val) = item.as_str() { + val == member_path_str + } else { + false + } + }); + + if !already_exists { + // Add the new member + members.push(member_path_str); + } + + // Write the updated Cargo.toml back + fs::write(&workspace_cargo_toml, doc.to_string()) + .context("Failed to write updated workspace Cargo.toml")?; + + Ok(()) +} From a12005facafbee90b558ed8863c376c97e8cf53e Mon Sep 17 00:00:00 2001 From: riemann Date: Fri, 7 Nov 2025 12:33:21 +0300 Subject: [PATCH 07/70] refactor: address nits --- examples/p2ide-note/Cargo.lock | 13 +- examples/p2ide-note/Cargo.toml | 2 +- examples/p2ide-note/src/lib.rs | 18 +- .../src/node_tests/basic_wallet.rs | 218 +++++++++++++++++- 4 files changed, 227 insertions(+), 24 deletions(-) diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index 170cbf443..1c74491eb 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -485,7 +485,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.6.0" +version = "0.7.0" dependencies = [ "miden-base", "miden-base-sys", @@ -543,7 +543,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.6.0" +version = "0.7.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -552,8 +552,9 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.6.0" +version = "0.7.0" dependencies = [ + "heck", "miden-objects", "proc-macro2", "quote", @@ -564,7 +565,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.6.0" +version = "0.7.0" dependencies = [ "miden-stdlib-sys", ] @@ -710,11 +711,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.6.0" +version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.6.0" +version = "0.7.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/p2ide-note/Cargo.toml b/examples/p2ide-note/Cargo.toml index 186d54376..a0e93ec29 100644 --- a/examples/p2ide-note/Cargo.toml +++ b/examples/p2ide-note/Cargo.toml @@ -27,7 +27,7 @@ project-kind = "note-script" [package.metadata.component.target.dependencies] -"miden:basic-wallet" = { path = "../basic-wallet/wit/basic-wallet.wit" } +"miden:basic-wallet" = { path = "../basic-wallet/target/generated-wit/" } [profile.release] trim-paths = ["diagnostics", "object"] diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index 9a8366022..faeed9629 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -7,17 +7,6 @@ // extern crate alloc; // use alloc::vec::Vec; -// Global allocator to use heap memory in no-std environment -#[global_allocator] -static ALLOC: miden::BumpAlloc = miden::BumpAlloc::new(); - -// Required for no-std crates -#[cfg(not(test))] -#[panic_handler] -fn my_panic(_info: &core::panic::PanicInfo) -> ! { - loop {} -} - use miden::*; use crate::bindings::miden::basic_wallet::basic_wallet::receive_asset; @@ -42,15 +31,16 @@ fn reclaim_assets(consuming_account: AccountId) { #[note_script] fn run(_arg: Word) { let inputs = note::get_inputs(); + + // make sure the number of inputs is 4 + assert_eq(inputs.len().into(), felt!(4)); + let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; let timelock_height = inputs[2]; let reclaim_height = inputs[3]; - // make sure the number of inputs is 4 - assert_eq(inputs.len().into(), Felt::from(4u32)); - // get block number let block_number = tx::get_block_number(); assert!(block_number >= timelock_height); diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index ca5f71401..df74ac02b 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -201,7 +201,11 @@ pub fn test_basic_wallet_p2id_local() { } /// Tests the basic-wallet contract deployment and p2ide note consumption workflow on a local node. -/// This is a simplified test demonstrating P2IDE note functionality without timelock/reclaim. +/// +/// 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) @@ -341,8 +345,7 @@ pub fn test_basic_wallet_p2ide_local() { let timelock_height = Felt::new(0); let reclaim_height = Felt::new(0); - // Create the p2ide note with only 2 inputs (account ID) - // This is a simplified P2IDE note without timelock/reclaim functionality + // Create the p2ide note let p2ide_note = create_note_from_package( &mut client, p2ide_note_package.clone(), @@ -408,3 +411,212 @@ pub fn test_basic_wallet_p2ide_local() { .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_result = + client.new_transaction(faucet_account.id(), mint_request).await.unwrap(); + let mint_tx_id = mint_tx_result.executed_transaction().id(); + eprintln!("Created mint transaction. Tx ID: {mint_tx_id:?}"); + + client.submit_transaction(mint_tx_result).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 = client + .new_transaction(alice_account.id(), consume_request) + .await + .map_err(|e| format!("{e:?}")) + .unwrap(); + + client.submit_transaction(consume_tx).await.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 transfer_tx_result = + client.new_transaction(alice_account.id(), transfer_request).await.unwrap(); + let alice_tx_id = transfer_tx_result.executed_transaction().id(); + eprintln!("Alice created p2ide transaction. Tx ID: {alice_tx_id:?}"); + + client.submit_transaction(transfer_tx_result).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 = client.new_transaction(alice_account.id(), reclaim_request).await.unwrap(); + let reclaim_tx_id = reclaim_tx.executed_transaction().id(); + eprintln!("Alice created reclaim transaction. Tx ID: {reclaim_tx_id:?}"); + + client.submit_transaction(reclaim_tx).await.unwrap(); + + 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 ==="); + }); +} From 4a6a26a7a07aa41c2ec5fc715850c366a119ee84 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 13 Nov 2025 07:08:51 +0200 Subject: [PATCH 08/70] chore: fix permissions for the release workflow to trigger CI checks --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ea5ac7a3..819545242 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,6 +110,7 @@ jobs: permissions: contents: write pull-requests: write + actions: write concurrency: group: release-plz-${{ github.ref }} cancel-in-progress: false From df6578f59a7f105f9c5d23e98f30bd507950cd4c Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 13 Nov 2025 16:02:05 +0200 Subject: [PATCH 09/70] chore: update expect files (after the release) --- examples/auth-component-no-auth/Cargo.lock | 10 +++++----- examples/auth-component-rpo-falcon512/Cargo.lock | 10 +++++----- examples/basic-wallet-tx-script/Cargo.lock | 10 +++++----- examples/basic-wallet/Cargo.lock | 10 +++++----- examples/counter-contract/Cargo.lock | 10 +++++----- examples/counter-note/Cargo.lock | 10 +++++----- examples/p2id-note/Cargo.lock | 10 +++++----- examples/storage-example/Cargo.lock | 10 +++++----- .../expected/abi_transform_tx_kernel_get_inputs_4.hir | 2 +- .../expected/abi_transform_tx_kernel_get_inputs_4.masm | 2 +- .../expected/abi_transform_tx_kernel_get_inputs_4.wat | 2 +- tests/integration/expected/adv_load_preimage.hir | 2 +- tests/integration/expected/adv_load_preimage.masm | 2 +- tests/integration/expected/adv_load_preimage.wat | 2 +- .../expected/examples/basic_wallet_tx_script.hir | 2 +- .../expected/examples/basic_wallet_tx_script.masm | 2 +- .../expected/examples/basic_wallet_tx_script.wat | 2 +- tests/integration/expected/examples/p2id.hir | 2 +- tests/integration/expected/examples/p2id.masm | 2 +- tests/integration/expected/examples/p2id.wat | 2 +- .../rust_sdk_input_note_get_assets_binding.hir | 2 +- .../rust_sdk_input_note_get_assets_binding.masm | 2 +- .../rust_sdk_input_note_get_assets_binding.wat | 2 +- .../rust_sdk_output_note_get_assets_binding.hir | 2 +- .../rust_sdk_output_note_get_assets_binding.masm | 2 +- .../rust_sdk_output_note_get_assets_binding.wat | 2 +- tests/rust-apps-wasm/rust-sdk/add/Cargo.lock | 10 +++++----- .../rust-sdk/component-macros-account/Cargo.lock | 10 +++++----- .../rust-sdk/component-macros-note/Cargo.lock | 10 +++++----- .../rust-sdk/cross-ctx-account-word-arg/Cargo.lock | 10 +++++----- .../rust-sdk/cross-ctx-account-word/Cargo.lock | 10 +++++----- .../rust-sdk/cross-ctx-account/Cargo.lock | 10 +++++----- .../rust-sdk/cross-ctx-note-word-arg/Cargo.lock | 10 +++++----- .../rust-sdk/cross-ctx-note-word/Cargo.lock | 10 +++++----- .../rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock | 10 +++++----- 35 files changed, 103 insertions(+), 103 deletions(-) diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index 33e90bb3f..a3106a54a 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -803,7 +803,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -862,7 +862,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -871,7 +871,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -884,7 +884,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1066,7 +1066,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/auth-component-rpo-falcon512/Cargo.lock b/examples/auth-component-rpo-falcon512/Cargo.lock index 98adb89b8..69b9a03c1 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.lock +++ b/examples/auth-component-rpo-falcon512/Cargo.lock @@ -804,7 +804,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -863,7 +863,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -872,7 +872,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -885,7 +885,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1067,7 +1067,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index e0443e1b7..a732370d1 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index 9bd4627b8..b7b698953 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index f488a5aae..94ff57c22 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index e5b0c193b..6ebef5a68 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index 009599686..c5530be26 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -789,7 +789,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -848,7 +848,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -857,7 +857,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -870,7 +870,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1052,7 +1052,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 137d8dd2a..60d375101 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -789,7 +789,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -848,7 +848,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -857,7 +857,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -870,7 +870,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1052,7 +1052,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 index 589ae35fd..ce3ce0e3d 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir @@ -1102,6 +1102,6 @@ builtin.component root_ns:root@1.0.0 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x00000001000000210000001f00000030001000000000000073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x00000001000000210000001f00000030001000000000000073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; }; }; \ 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 index d3828a4d1..88710f762 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm @@ -5,7 +5,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[4557231304381646024,333629999424525359,2740222180108318868,7644147313808679059] + push.[1554473420111659168,832244429625754668,5418308924757320907,17702588667154917010] adv.push_mapval push.262144 push.5 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 index 60f884cc6..018214241 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat @@ -615,5 +615,5 @@ end local.get 2 ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/active_note.rs\00\00\00\00\00\00\10\000\00\00\00\1f\00\00\00!\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/active_note.rs\00\00\00\00\00\00\10\000\00\00\00\1f\00\00\00!\00\00\00\01\00\00\00") ) diff --git a/tests/integration/expected/adv_load_preimage.hir b/tests/integration/expected/adv_load_preimage.hir index bc1efc8c3..a29bf56c4 100644 --- a/tests/integration/expected/adv_load_preimage.hir +++ b/tests/integration/expected/adv_load_preimage.hir @@ -745,6 +745,6 @@ builtin.component root_ns:root@1.0.0 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x000000210000009700000028001000000000000073722e6d656d2f62696c6474732f6372732f302e372e302d7379732d62696c6474732d6e6564696d; + builtin.segment readonly @1048576 = 0x000000210000009700000028001000000000000073722e6d656d2f62696c6474732f6372732f312e372e302d7379732d62696c6474732d6e6564696d; }; }; \ No newline at end of file diff --git a/tests/integration/expected/adv_load_preimage.masm b/tests/integration/expected/adv_load_preimage.masm index 74ace7d60..aaa68e1e5 100644 --- a/tests/integration/expected/adv_load_preimage.masm +++ b/tests/integration/expected/adv_load_preimage.masm @@ -5,7 +5,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[16950219637129648594,11360386184375194274,15319753906541904406,1352422243874904212] + push.[9819768856120359178,13486156918318591171,2261048595876917691,16294779277798976606] adv.push_mapval push.262144 push.4 diff --git a/tests/integration/expected/adv_load_preimage.wat b/tests/integration/expected/adv_load_preimage.wat index 458452cf0..5fc4581f5 100644 --- a/tests/integration/expected/adv_load_preimage.wat +++ b/tests/integration/expected/adv_load_preimage.wat @@ -432,5 +432,5 @@ i32.gt_u select ) - (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.7.0/src/stdlib/mem.rs\00\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.7.1/src/stdlib/mem.rs\00\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00") ) diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index 5fd44a641..28864324a 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -1259,7 +1259,7 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e62696c2f6372730073722e6d656d2f62696c6474732f6372732f302e372e302d7379732d62696c6474732d6e6564696d; + builtin.segment readonly @1048576 = 0x0073722e62696c2f6372730073722e6d656d2f62696c6474732f6372732f312e372e302d7379732d62696c6474732d6e6564696d; builtin.segment @1048628 = 0x00000021000000270000000a0010002900000025000000250000000a0010002900000021000000970000002800100000000000010000000100000001; }; diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.masm b/tests/integration/expected/examples/basic_wallet_tx_script.masm index 343dafb85..36eccff71 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -16,7 +16,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[18126909968619574227,17760723618876885851,16026017854059965402,12528080323114809843] + push.[10151340310367592649,1643550100843527730,13897610209430550998,3750372866565455699] adv.push_mapval push.262144 push.7 diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index 37d8426b0..098ea2c59 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -737,7 +737,7 @@ (func $miden::output_note::create (;30;) (type 17) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.7.0/src/stdlib/mem.rs\00src/lib.rs\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.7.1/src/stdlib/mem.rs\00src/lib.rs\00") (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00)\00\10\00\0a\00\00\00%\00\00\00%\00\00\00)\00\10\00\0a\00\00\00'\00\00\00!\00\00\00") ) (alias export 0 "word" (type (;4;))) diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index bee3abe48..90faf3e3b 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -1283,7 +1283,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; builtin.segment @1048628 = 0x000000220000003d0000003000100000000000210000001f0000003000100000000000010000000100000001; }; diff --git a/tests/integration/expected/examples/p2id.masm b/tests/integration/expected/examples/p2id.masm index aa9e4e85e..8a5c5e048 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -16,7 +16,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[14053965066302455976,5462514524604701753,12455741123103170362,7752163708621042617] + push.[9678401178389669350,4413180703889426351,1344973330089033162,11194032919842094804] adv.push_mapval push.262144 push.6 diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index aa2c8bf0b..0a9119715 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -713,7 +713,7 @@ (func $miden::active_note::get_assets (;27;) (type 11) (param i32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/active_note.rs\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/active_note.rs\00") (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00\1f\00\00\00!\00\00\00\00\00\10\000\00\00\00=\00\00\00\22\00\00\00") ) (alias export 0 "word" (type (;3;))) 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 12c7989c9..18ac9892e 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 @@ -945,7 +945,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f7475706e692f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f7475706e692f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; builtin.segment @1048624 = 0x000000220000003f0000002f001000000000000100000001; }; 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 700ba890e..bbf0f19a8 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 @@ -18,7 +18,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[13233865733382452766,13008203156939924947,13638025381147799114,8047631572047953282] + push.[3782401883760717684,9295017189735772129,18169115864861297568,15636957763524619456] adv.push_mapval push.262144 push.5 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 80ef97976..af3e5dd85 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 @@ -551,7 +551,7 @@ (func $miden::input_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/input_note.rs\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/input_note.rs\00") (data $.data (;1;) (i32.const 1048624) "\01\00\00\00\01\00\00\00\00\00\10\00/\00\00\00?\00\00\00\22\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") ) 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 467f6cfd5..f2e4e9b1b 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 @@ -945,7 +945,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f74757074756f2f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f74757074756f2f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; builtin.segment @1048628 = 0x000000220000006500000030001000000000000100000001; }; 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 1903a602f..6ef08bce4 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 @@ -18,7 +18,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[16328506470805530145,17778698289722371564,929519036494728460,12225220874644472837] + push.[1299769949614318155,17537286569450742772,6595043140619191035,14014199975760862929] adv.push_mapval push.262144 push.5 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 294d24264..c12fc3177 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 @@ -551,7 +551,7 @@ (func $miden::output_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/output_note.rs\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/output_note.rs\00") (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00e\00\00\00\22\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") ) diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index 625bf0af2..c221a348a 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -789,7 +789,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -848,7 +848,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -857,7 +857,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -870,7 +870,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1052,7 +1052,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 191318e9b..3707ae2a0 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 @@ -809,7 +809,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -868,7 +868,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -890,7 +890,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1072,7 +1072,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 5fd1ff1ee..863bc24c8 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 @@ -809,7 +809,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -868,7 +868,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -890,7 +890,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1072,7 +1072,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 b7eb5b309..e5e8eab32 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 436777d14..5ea05f47b 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 02f3f1ba3..1881f4ec9 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 a2d19d3ba..8a557f7fe 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 35eb47e70..96af9c888 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" 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 2ba3d6797..4a4be16ab 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] @@ -1059,7 +1059,7 @@ version = "0.7.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" From b862fb47e1e86ce134a0ffbabec6120dec016112 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 21 Nov 2025 19:08:54 -0300 Subject: [PATCH 10/70] chore: update p2ide note example and test to use SDK v0.8 and miden-client v0.12 --- examples/p2ide-note/Cargo.lock | 1133 ++++++++++++++++- examples/p2ide-note/src/lib.rs | 16 +- .../src/node_tests/basic_wallet.rs | 62 +- 3 files changed, 1101 insertions(+), 110 deletions(-) diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index 1c74491eb..5dc6b40e9 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -2,6 +2,31 @@ # 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -11,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" @@ -44,6 +119,42 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -105,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -114,6 +227,53 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[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 = "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -129,6 +289,43 @@ dependencies = [ "libc", ] +[[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.6" @@ -136,9 +333,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 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", +] + +[[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 = "derive_more" version = "2.0.1" @@ -166,7 +401,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -175,12 +412,70 @@ 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" @@ -190,24 +485,106 @@ 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" +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.59.0", +] + +[[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 = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[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 = "foldhash" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62d91fd049c123429b018c47887d3f75a265540dd3c30ba9cb7bae9197edb03a" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -291,6 +668,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -303,16 +694,33 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[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.4" @@ -328,6 +736,24 @@ 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.2.1" @@ -351,6 +777,27 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +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" @@ -366,6 +813,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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" @@ -376,6 +857,20 @@ dependencies = [ "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" @@ -439,6 +934,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" @@ -485,7 +986,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -496,11 +997,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -508,9 +1010,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -522,9 +1024,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -534,6 +1036,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -543,7 +1046,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -552,7 +1055,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "heck", "miden-objects", @@ -565,20 +1068,22 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.7.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -588,35 +1093,59 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "cc", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] @@ -631,13 +1160,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -646,6 +1176,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", @@ -658,7 +1190,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", + "supports-color", + "supports-hyperlinks", + "supports-unicode", "syn", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -678,33 +1214,42 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "57ea15ca33d7735e08e81afd9c9f4f02fc0259ec019fcb4ec44192c205743553" dependencies = [ "bech32", - "getrandom", + "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", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -713,15 +1258,31 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.7.0" +[[package]] +name = "miden-stdlib" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e90a5de45a1e6213ff17b66fff8accde0bbc64264e2c22bbcb9a895f8f3b767" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "thiserror", +] + [[package]] name = "miden-stdlib-sys" -version = "0.7.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -730,21 +1291,31 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -755,15 +1326,33 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -865,12 +1454,33 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -910,7 +1520,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -950,6 +1560,51 @@ 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.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -975,6 +1630,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" @@ -996,7 +1666,27 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_chacha", + "rand_core 0.9.3", +] + +[[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.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1004,6 +1694,47 @@ 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" +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.3", +] + +[[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" @@ -1016,13 +1747,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1768,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1789,22 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[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.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1076,6 +1823,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" @@ -1109,6 +1869,20 @@ 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" @@ -1135,18 +1909,28 @@ 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", @@ -1183,6 +1967,17 @@ dependencies = [ "serde", ] +[[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" @@ -1208,6 +2003,16 @@ 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 = "siphasher" version = "1.0.1" @@ -1231,6 +2036,19 @@ 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 = "string_cache" @@ -1253,6 +2071,33 @@ dependencies = [ "vte", ] +[[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.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "804f44ed3c63152de6a9f90acbea1a110441de43006ea51bcce8f436196a288b" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + [[package]] name = "syn" version = "2.0.106" @@ -1276,7 +2121,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]] @@ -1288,6 +2133,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" @@ -1328,6 +2183,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1492,6 +2356,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" @@ -1522,6 +2392,22 @@ 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" @@ -1553,6 +2439,12 @@ dependencies = [ "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 = "wasi" version = "0.14.2+wasi-0.2.4" @@ -1675,7 +2567,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]] @@ -1693,7 +2585,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -1714,7 +2606,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -1726,7 +2618,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", ] @@ -1758,6 +2650,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" @@ -1765,7 +2663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -1774,7 +2672,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]] @@ -1783,7 +2681,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]] @@ -1792,7 +2699,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]] @@ -1801,14 +2732,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]] @@ -1817,21 +2748,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" @@ -1844,24 +2793,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" @@ -2062,3 +3035,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[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.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index faeed9629..ec0893b71 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -12,14 +12,14 @@ use miden::*; use crate::bindings::miden::basic_wallet::basic_wallet::receive_asset; fn consume_assets() { - let assets = note::get_assets(); + let assets = active_note::get_assets(); for asset in assets { receive_asset(asset); } } fn reclaim_assets(consuming_account: AccountId) { - let creator_account = note::get_sender(); + let creator_account = active_note::get_sender(); if consuming_account == creator_account { consume_assets(); @@ -30,14 +30,14 @@ fn reclaim_assets(consuming_account: AccountId) { #[note_script] fn run(_arg: Word) { - let inputs = note::get_inputs(); - + let inputs = active_note::get_inputs(); + // make sure the number of inputs is 4 - assert_eq(inputs.len().into(), felt!(4)); - + assert_eq((inputs.len() as u32).into(), felt!(4)); + let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; - + let timelock_height = inputs[2]; let reclaim_height = inputs[3]; @@ -46,7 +46,7 @@ fn run(_arg: Word) { assert!(block_number >= timelock_height); // get consuming account id - let consuming_account_id = account::get_id(); + let consuming_account_id = active_account::get_id(); // target account id let target_account_id = AccountId::from(target_account_id_prefix, target_account_id_suffix); diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index 1cebf56e7..a9e8ce019 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -277,12 +277,8 @@ pub fn test_basic_wallet_p2ide_local() { .build() .unwrap(); - let mint_tx_result = - client.new_transaction(faucet_account.id(), mint_request).await.unwrap(); - let mint_tx_id = mint_tx_result.executed_transaction().id(); - eprintln!("Created mint transaction. Tx ID: {mint_tx_id:?}"); - - client.submit_transaction(mint_tx_result).await.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 @@ -293,14 +289,12 @@ pub fn test_basic_wallet_p2ide_local() { .build() .unwrap(); - let consume_tx = client - .new_transaction(alice_account.id(), consume_request) + let _consume_tx_id = client + .submit_new_transaction(alice_account.id(), consume_request) .await .map_err(|e| format!("{e:?}")) .unwrap(); - client.submit_transaction(consume_tx).await.unwrap(); - eprintln!("\n=== Checking Alice's account has the minted asset ==="); assert_account_has_fungible_asset( @@ -360,12 +354,10 @@ pub fn test_basic_wallet_p2ide_local() { .build() .unwrap(); - let transfer_tx_result = - client.new_transaction(alice_account.id(), transfer_request).await.unwrap(); - let alice_tx_id = transfer_tx_result.executed_transaction().id(); - eprintln!("Alice created p2ide transaction. Tx ID: {alice_tx_id:?}"); - - client.submit_transaction(transfer_tx_result).await.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 @@ -376,12 +368,10 @@ pub fn test_basic_wallet_p2ide_local() { .build() .unwrap(); - let consume_tx = client.new_transaction(bob_account.id(), consume_request).await.unwrap(); - let consume_tx_id = consume_tx.executed_transaction().id(); + 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:?}"); - client.submit_transaction(consume_tx).await.unwrap(); - eprintln!("\n=== Checking Bob's account has the transferred asset ==="); assert_account_has_fungible_asset( @@ -490,12 +480,8 @@ pub fn test_basic_wallet_p2ide_reclaim_local() { .build() .unwrap(); - let mint_tx_result = - client.new_transaction(faucet_account.id(), mint_request).await.unwrap(); - let mint_tx_id = mint_tx_result.executed_transaction().id(); - eprintln!("Created mint transaction. Tx ID: {mint_tx_id:?}"); - - client.submit_transaction(mint_tx_result).await.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 @@ -506,14 +492,12 @@ pub fn test_basic_wallet_p2ide_reclaim_local() { .build() .unwrap(); - let consume_tx = client - .new_transaction(alice_account.id(), consume_request) + let _consume_tx_id = client + .submit_new_transaction(alice_account.id(), consume_request) .await .map_err(|e| format!("{e:?}")) .unwrap(); - client.submit_transaction(consume_tx).await.unwrap(); - eprintln!("\n=== Checking Alice's account has the minted asset ==="); assert_account_has_fungible_asset( @@ -575,12 +559,10 @@ pub fn test_basic_wallet_p2ide_reclaim_local() { .build() .unwrap(); - let transfer_tx_result = - client.new_transaction(alice_account.id(), transfer_request).await.unwrap(); - let alice_tx_id = transfer_tx_result.executed_transaction().id(); - eprintln!("Alice created p2ide transaction. Tx ID: {alice_tx_id:?}"); - - client.submit_transaction(transfer_tx_result).await.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) @@ -591,12 +573,12 @@ pub fn test_basic_wallet_p2ide_reclaim_local() { .build() .unwrap(); - let reclaim_tx = client.new_transaction(alice_account.id(), reclaim_request).await.unwrap(); - let reclaim_tx_id = reclaim_tx.executed_transaction().id(); + 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:?}"); - client.submit_transaction(reclaim_tx).await.unwrap(); - eprintln!("\n=== Checking Alice's account has reclaimed the asset ==="); // Alice should have her original amount back (mint_amount) From 0e112ac46e582b3b4a2d764246f454524c573fb8 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Sun, 23 Nov 2025 07:55:21 +0100 Subject: [PATCH 11/70] chore: remove the panic source file location in the data segment --- .../abi_transform_tx_kernel_get_inputs_4.hir | 1310 +++++------ .../abi_transform_tx_kernel_get_inputs_4.masm | 57 +- .../abi_transform_tx_kernel_get_inputs_4.wat | 51 +- .../expected/adv_load_preimage.hir | 8 +- .../expected/adv_load_preimage.masm | 30 +- .../expected/adv_load_preimage.wat | 8 +- .../examples/basic_wallet_tx_script.hir | 1975 ++++++++--------- .../examples/basic_wallet_tx_script.masm | 115 +- .../examples/basic_wallet_tx_script.wat | 79 +- tests/integration/expected/examples/p2id.hir | 1667 +++++++------- tests/integration/expected/examples/p2id.masm | 131 +- tests/integration/expected/examples/p2id.wat | 86 +- ...rust_sdk_input_note_get_assets_binding.hir | 1252 +++++------ ...ust_sdk_input_note_get_assets_binding.masm | 107 +- ...rust_sdk_input_note_get_assets_binding.wat | 72 +- ...ust_sdk_output_note_get_assets_binding.hir | 1252 +++++------ ...st_sdk_output_note_get_assets_binding.masm | 107 +- ...ust_sdk_output_note_get_assets_binding.wat | 72 +- tools/cargo-miden/src/commands/build.rs | 10 +- 19 files changed, 4162 insertions(+), 4227 deletions(-) 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 index ce3ce0e3d..dc51a3bd1 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir @@ -22,130 +22,130 @@ builtin.component root_ns:root@1.0.0 { v15 = hir.int_to_ptr v12 : ptr; v16 = hir.load v15 : i32; v17 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/>::from(v16) : felt - v766 = arith.constant 4 : i32; - v19 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v766) : felt + v765 = arith.constant 4 : i32; + v19 = 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(v17, v19) - v765 = arith.constant 0 : i32; + v764 = arith.constant 0 : i32; v0 = arith.constant 0 : i32; v21 = arith.eq v16, v0 : i1; v22 = arith.zext v21 : u32; v23 = hir.bitcast v22 : i32; - v25 = arith.neq v23, v765 : i1; - v736 = scf.if v25 : u32 { + v25 = arith.neq v23, v764 : i1; + v735 = scf.if v25 : u32 { ^block112: - v732 = arith.constant 0 : u32; - scf.yield v732; + v731 = arith.constant 0 : u32; + scf.yield v731; } else { ^block7: v27 = arith.constant 8 : u32; v26 = hir.bitcast v5 : u32; v28 = arith.add v26, v27 : u32 #[overflow = checked]; - v764 = arith.constant 4 : u32; - v30 = arith.mod v28, v764 : u32; + v763 = arith.constant 4 : u32; + v30 = arith.mod v28, v763 : u32; hir.assertz v30 #[code = 250]; v31 = hir.int_to_ptr v28 : ptr; v32 = hir.load v31 : i32; v33 = hir.bitcast v32 : u32; - v763 = arith.constant 4 : u32; - v35 = arith.mod v33, v763 : u32; + v762 = arith.constant 4 : u32; + v35 = arith.mod v33, v762 : u32; hir.assertz v35 #[code = 250]; v36 = hir.int_to_ptr v33 : ptr; v37 = hir.load v36 : felt; v38 = arith.constant -1 : i32; v39 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v38) : felt hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v37, v39) - v762 = arith.constant 0 : i32; + v761 = arith.constant 0 : i32; v40 = arith.constant 1 : i32; v41 = arith.eq v16, v40 : i1; v42 = arith.zext v41 : u32; v43 = hir.bitcast v42 : i32; - v45 = arith.neq v43, v762 : i1; - v738 = scf.if v45 : u32 { + v45 = arith.neq v43, v761 : i1; + v737 = scf.if v45 : u32 { ^block111: - v761 = arith.constant 0 : u32; - scf.yield v761; + v760 = arith.constant 0 : u32; + scf.yield v760; } else { ^block8: - v760 = arith.constant 4 : u32; - v46 = hir.bitcast v32 : u32; - v48 = arith.add v46, v760 : u32 #[overflow = checked]; v759 = arith.constant 4 : u32; - v50 = arith.mod v48, v759 : u32; + v46 = hir.bitcast v32 : u32; + v48 = arith.add v46, v759 : u32 #[overflow = checked]; + v758 = arith.constant 4 : u32; + v50 = arith.mod v48, v758 : u32; hir.assertz v50 #[code = 250]; v51 = hir.int_to_ptr v48 : ptr; v52 = hir.load v51 : felt; - v758 = arith.constant 1 : i32; - v54 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v758) : felt + v757 = arith.constant 1 : i32; + v54 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v757) : felt hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v52, v54) - v757 = arith.constant 0 : i32; - v731 = arith.constant 2 : u32; + v756 = arith.constant 0 : i32; + v730 = arith.constant 2 : u32; v56 = hir.bitcast v16 : u32; - v58 = arith.lte v56, v731 : i1; + v58 = arith.lte v56, v730 : i1; v59 = arith.zext v58 : u32; v60 = hir.bitcast v59 : i32; - v62 = arith.neq v60, v757 : i1; - v740 = scf.if v62 : u32 { + v62 = arith.neq v60, v756 : i1; + v739 = scf.if v62 : u32 { ^block110: - v756 = arith.constant 0 : u32; - scf.yield v756; + v755 = arith.constant 0 : u32; + scf.yield v755; } else { ^block9: - v755 = arith.constant 8 : u32; + v754 = arith.constant 8 : u32; v63 = hir.bitcast v32 : u32; - v65 = arith.add v63, v755 : u32 #[overflow = checked]; - v754 = arith.constant 4 : u32; - v67 = arith.mod v65, v754 : u32; + v65 = arith.add v63, v754 : u32 #[overflow = checked]; + v753 = arith.constant 4 : u32; + v67 = arith.mod v65, v753 : u32; hir.assertz v67 #[code = 250]; v68 = hir.int_to_ptr v65 : ptr; v69 = hir.load v68 : felt; v55 = arith.constant 2 : i32; v71 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v55) : felt hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v69, v71) - v753 = arith.constant 0 : i32; + v752 = arith.constant 0 : i32; v72 = arith.constant 3 : i32; v73 = arith.eq v16, v72 : i1; v74 = arith.zext v73 : u32; v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v753 : i1; + v77 = arith.neq v75, v752 : i1; scf.if v77{ ^block109: scf.yield ; } else { ^block10: - v752 = arith.constant 12 : u32; + v751 = arith.constant 12 : u32; v78 = hir.bitcast v32 : u32; - v80 = arith.add v78, v752 : u32 #[overflow = checked]; - v751 = arith.constant 4 : u32; - v82 = arith.mod v80, v751 : u32; + v80 = arith.add v78, v751 : u32 #[overflow = checked]; + v750 = arith.constant 4 : u32; + v82 = arith.mod v80, v750 : u32; hir.assertz v82 #[code = 250]; v83 = hir.int_to_ptr v80 : ptr; v84 = hir.load v83 : felt; - v750 = arith.constant 3 : i32; - v86 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v750) : felt + v749 = arith.constant 3 : i32; + v86 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v749) : felt hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v84, v86) + v747 = arith.constant 4 : i32; v748 = arith.constant 4 : i32; - v749 = arith.constant 4 : i32; - v88 = arith.add v5, v749 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::deallocate(v88, v748, v748) - v747 = arith.constant 16 : i32; - v92 = arith.add v5, v747 : i32 #[overflow = wrapping]; + v88 = arith.add v5, v748 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::deallocate(v88, v747, v747) + v746 = arith.constant 16 : i32; + v92 = arith.add v5, v746 : i32 #[overflow = wrapping]; v93 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr v94 = hir.bitcast v93 : ptr; hir.store v94, v92; scf.yield ; }; - v734 = arith.constant 1 : u32; - v746 = arith.constant 0 : u32; - v744 = cf.select v77, v746, v734 : u32; - scf.yield v744; + v733 = arith.constant 1 : u32; + v745 = arith.constant 0 : u32; + v743 = cf.select v77, v745, v733 : u32; + scf.yield v743; }; - scf.yield v740; + scf.yield v739; }; - scf.yield v738; + scf.yield v737; }; - v745 = arith.constant 0 : u32; - v743 = arith.eq v736, v745 : i1; - cf.cond_br v743 ^block6, ^block114; + v744 = arith.constant 0 : u32; + v742 = arith.eq v735, v744 : i1; + cf.cond_br v742 ^block6, ^block114; ^block6: ub.unreachable ; ^block114: @@ -154,7 +154,7 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @__rustc::__rust_alloc(v95: i32, v96: i32) -> i32 { ^block11(v95: i32, v96: i32): - v98 = arith.constant 1048648 : i32; + v98 = arith.constant 1048608 : i32; v99 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v98, v96, v95) : i32 builtin.ret v99; }; @@ -166,33 +166,33 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @__rustc::__rust_realloc(v103: i32, v104: i32, v105: i32, v106: i32) -> i32 { ^block15(v103: i32, v104: i32, v105: i32, v106: i32): - v108 = arith.constant 1048648 : i32; + v108 = arith.constant 1048608 : i32; v109 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v108, v105, v106) : i32 - v775 = arith.constant 0 : i32; + v774 = arith.constant 0 : i32; v110 = arith.constant 0 : i32; v111 = arith.eq v109, v110 : i1; v112 = arith.zext v111 : u32; v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v775 : i1; + v115 = arith.neq v113, v774 : i1; scf.if v115{ ^block17: scf.yield ; } else { ^block18: - v774 = arith.constant 0 : i32; + v773 = arith.constant 0 : i32; v117 = hir.bitcast v104 : u32; v116 = hir.bitcast v106 : u32; v118 = arith.lt v116, v117 : i1; v119 = arith.zext v118 : u32; v120 = hir.bitcast v119 : i32; - v122 = arith.neq v120, v774 : i1; + v122 = arith.neq v120, v773 : i1; v123 = cf.select v122, v106, v104 : i32; + v771 = arith.constant 0 : i32; v772 = arith.constant 0 : i32; - v773 = arith.constant 0 : i32; - v125 = arith.eq v123, v773 : i1; + v125 = arith.eq v123, v772 : i1; v126 = arith.zext v125 : u32; v127 = hir.bitcast v126 : i32; - v129 = arith.neq v127, v772 : i1; + v129 = arith.neq v127, v771 : i1; scf.if v129{ ^block119: scf.yield ; @@ -213,35 +213,35 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @__rustc::__rust_alloc_zeroed(v136: i32, v137: i32) -> i32 { ^block20(v136: i32, v137: i32): - v139 = arith.constant 1048648 : i32; + v139 = arith.constant 1048608 : i32; v140 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v139, v137, v136) : i32 - v784 = arith.constant 0 : i32; + v783 = arith.constant 0 : i32; v141 = arith.constant 0 : i32; v142 = arith.eq v140, v141 : i1; v143 = arith.zext v142 : u32; v144 = hir.bitcast v143 : i32; - v146 = arith.neq v144, v784 : i1; + v146 = arith.neq v144, v783 : i1; scf.if v146{ ^block22: scf.yield ; } else { ^block23: + v781 = arith.constant 0 : i32; v782 = arith.constant 0 : i32; - v783 = arith.constant 0 : i32; - v148 = arith.eq v136, v783 : i1; + v148 = arith.eq v136, v782 : i1; v149 = arith.zext v148 : u32; v150 = hir.bitcast v149 : i32; - v152 = arith.neq v150, v782 : i1; + v152 = arith.neq v150, v781 : i1; scf.if v152{ ^block122: scf.yield ; } else { ^block24: - v776 = arith.constant 0 : u8; + v775 = arith.constant 0 : u8; v155 = hir.bitcast v136 : u32; v156 = hir.bitcast v140 : u32; v157 = hir.int_to_ptr v156 : ptr; - hir.mem_set v157, v155, v776; + hir.mem_set v157, v155, v775; scf.yield ; }; scf.yield ; @@ -258,27 +258,27 @@ builtin.component root_ns:root@1.0.0 { ^block27(v159: i32, v160: i32, v161: i32): v164 = arith.constant 16 : i32; v163 = arith.constant 0 : i32; - v786 = arith.constant 16 : u32; + v785 = arith.constant 16 : u32; v166 = hir.bitcast v160 : u32; - v168 = arith.gt v166, v786 : i1; + v168 = arith.gt v166, v785 : i1; v169 = arith.zext v168 : u32; v170 = hir.bitcast v169 : i32; v172 = arith.neq v170, v163 : i1; v173 = cf.select v172, v160, v164 : i32; - v826 = arith.constant 0 : i32; + v825 = 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, v826 : i1; - v795, v796 = scf.if v178 : i32, u32 { + v178 = arith.neq v176, v825 : i1; + v794, v795 = scf.if v178 : i32, u32 { ^block127: - v787 = arith.constant 0 : u32; - v791 = ub.poison i32 : i32; - scf.yield v791, v787; + v786 = arith.constant 0 : u32; + v790 = ub.poison i32 : i32; + scf.yield v790, v786; } else { ^block30: v180 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/core::ptr::alignment::Alignment::max(v160, v173) : i32 - v825 = arith.constant 0 : i32; + v824 = arith.constant 0 : i32; v179 = arith.constant -2147483648 : i32; v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; v183 = hir.bitcast v181 : u32; @@ -286,18 +286,18 @@ builtin.component root_ns:root@1.0.0 { v184 = arith.gt v182, v183 : i1; v185 = arith.zext v184 : u32; v186 = hir.bitcast v185 : i32; - v188 = arith.neq v186, v825 : i1; - v810 = scf.if v188 : i32 { + v188 = arith.neq v186, v824 : i1; + v809 = scf.if v188 : i32 { ^block126: - v824 = ub.poison i32 : i32; - scf.yield v824; + v823 = ub.poison i32 : i32; + scf.yield v823; } else { ^block31: - v822 = arith.constant 0 : i32; - v194 = arith.sub v822, v180 : i32 #[overflow = wrapping]; - v823 = arith.constant -1 : i32; + v821 = arith.constant 0 : i32; + v194 = arith.sub v821, v180 : i32 #[overflow = wrapping]; + v822 = arith.constant -1 : i32; v190 = arith.add v161, v180 : i32 #[overflow = wrapping]; - v192 = arith.add v190, v823 : i32 #[overflow = wrapping]; + v192 = arith.add v190, v822 : i32 #[overflow = wrapping]; v195 = arith.band v192, v194 : i32; v196 = hir.bitcast v159 : u32; v197 = arith.constant 4 : u32; @@ -305,8 +305,8 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v198 #[code = 250]; v199 = hir.int_to_ptr v196 : ptr; v200 = hir.load v199 : i32; - v821 = arith.constant 0 : i32; - v202 = arith.neq v200, v821 : i1; + v820 = arith.constant 0 : i32; + v202 = arith.neq v200, v820 : i1; scf.if v202{ ^block125: scf.yield ; @@ -315,41 +315,41 @@ builtin.component root_ns:root@1.0.0 { 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; - v820 = arith.constant 4 : u32; - v212 = arith.mod v210, v820 : u32; + v819 = arith.constant 4 : u32; + v212 = arith.mod v210, v819 : u32; hir.assertz v212 #[code = 250]; - v819 = arith.constant 16 : u32; + v818 = arith.constant 16 : u32; v205 = hir.bitcast v204 : i32; - v208 = arith.shl v205, v819 : i32; + v208 = arith.shl v205, v818 : 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; - v818 = arith.constant 4 : u32; - v218 = arith.mod v216, v818 : u32; + v817 = arith.constant 4 : u32; + v218 = arith.mod v216, v817 : u32; hir.assertz v218 #[code = 250]; v219 = hir.int_to_ptr v216 : ptr; v220 = hir.load v219 : i32; - v816 = arith.constant 0 : i32; - v817 = arith.constant -1 : i32; - v222 = arith.bxor v220, v817 : i32; + v815 = arith.constant 0 : i32; + v816 = arith.constant -1 : i32; + v222 = arith.bxor v220, v816 : 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, v816 : i1; - v809 = scf.if v229 : i32 { + v229 = arith.neq v227, v815 : i1; + v808 = scf.if v229 : i32 { ^block34: - v815 = arith.constant 0 : i32; - scf.yield v815; + v814 = arith.constant 0 : i32; + scf.yield v814; } else { ^block35: v231 = hir.bitcast v159 : u32; - v814 = arith.constant 4 : u32; - v233 = arith.mod v231, v814 : u32; + v813 = arith.constant 4 : u32; + v233 = arith.mod v231, v813 : u32; hir.assertz v233 #[code = 250]; v230 = arith.add v220, v195 : i32 #[overflow = wrapping]; v234 = hir.int_to_ptr v231 : ptr; @@ -357,20 +357,20 @@ builtin.component root_ns:root@1.0.0 { v236 = arith.add v220, v180 : i32 #[overflow = wrapping]; scf.yield v236; }; - scf.yield v809; + scf.yield v808; }; - v792 = arith.constant 1 : u32; - v813 = arith.constant 0 : u32; - v811 = cf.select v188, v813, v792 : u32; - scf.yield v810, v811; + v791 = arith.constant 1 : u32; + v812 = arith.constant 0 : u32; + v810 = cf.select v188, v812, v791 : u32; + scf.yield v809, v810; }; - v812 = arith.constant 0 : u32; - v808 = arith.eq v796, v812 : i1; - cf.cond_br v808 ^block29, ^block129(v795); + v811 = arith.constant 0 : u32; + v807 = arith.eq v795, v811 : i1; + cf.cond_br v807 ^block29, ^block129(v794); ^block29: ub.unreachable ; - ^block129(v788: i32): - builtin.ret v788; + ^block129(v787: i32): + builtin.ret v787; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -379,83 +379,84 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v239; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v241: i32, v242: i32, v243: i32, v244: i32) { - ^block40(v241: i32, v242: i32, v243: i32, v244: i32): - v246 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v247 = hir.bitcast v246 : ptr; - v248 = hir.load v247 : i32; - v249 = arith.constant 16 : i32; - v250 = arith.sub v248, v249 : i32 #[overflow = wrapping]; - v251 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v252 = hir.bitcast v251 : ptr; - hir.store v252, v250; - v245 = arith.constant 0 : i32; - v255 = arith.constant 256 : i32; - v253 = arith.constant 4 : i32; - v254 = arith.add v250, v253 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::try_allocate_in(v254, v255, v245, v242, v243) - v258 = arith.constant 8 : u32; - v257 = hir.bitcast v250 : u32; - v259 = arith.add v257, v258 : u32 #[overflow = checked]; - v260 = arith.constant 4 : u32; - v261 = arith.mod v259, v260 : u32; - hir.assertz v261 #[code = 250]; - v262 = hir.int_to_ptr v259 : ptr; - v263 = hir.load v262 : i32; - v837 = arith.constant 4 : u32; - v264 = hir.bitcast v250 : u32; - v266 = arith.add v264, v837 : u32 #[overflow = checked]; + private builtin.function @alloc::raw_vec::RawVecInner::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/alloc::raw_vec::RawVecInner::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; v836 = arith.constant 4 : u32; - v268 = arith.mod v266, v836 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - v270 = hir.load v269 : i32; - v835 = arith.constant 0 : i32; - v271 = arith.constant 1 : i32; - v272 = arith.neq v270, v271 : i1; - v273 = arith.zext v272 : u32; - v274 = hir.bitcast v273 : i32; - v276 = arith.neq v274, v835 : i1; - cf.cond_br v276 ^block42, ^block43; + v263 = hir.bitcast v249 : u32; + v265 = arith.add v263, v836 : u32 #[overflow = checked]; + v835 = arith.constant 4 : u32; + v267 = arith.mod v265, v835 : u32; + hir.assertz v267 #[code = 250]; + v268 = hir.int_to_ptr v265 : ptr; + v269 = hir.load v268 : i32; + v834 = 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, v834 : i1; + cf.cond_br v275 ^block42, ^block43; ^block42: v285 = arith.constant 12 : u32; - v284 = hir.bitcast v250 : u32; + v284 = hir.bitcast v249 : u32; v286 = arith.add v284, v285 : u32 #[overflow = checked]; - v834 = arith.constant 4 : u32; - v288 = arith.mod v286, v834 : u32; + v833 = arith.constant 4 : u32; + v288 = arith.mod v286, v833 : u32; hir.assertz v288 #[code = 250]; v289 = hir.int_to_ptr v286 : ptr; v290 = hir.load v289 : i32; - v833 = arith.constant 4 : u32; - v291 = hir.bitcast v241 : u32; - v293 = arith.add v291, v833 : u32 #[overflow = checked]; v832 = arith.constant 4 : u32; - v295 = arith.mod v293, v832 : u32; + v291 = hir.bitcast v241 : u32; + v293 = arith.add v291, v832 : u32 #[overflow = checked]; + v831 = arith.constant 4 : u32; + v295 = arith.mod v293, v831 : u32; hir.assertz v295 #[code = 250]; v296 = hir.int_to_ptr v293 : ptr; hir.store v296, v290; v297 = hir.bitcast v241 : u32; - v831 = arith.constant 4 : u32; - v299 = arith.mod v297, v831 : u32; + v830 = arith.constant 4 : u32; + v299 = arith.mod v297, v830 : u32; hir.assertz v299 #[code = 250]; v300 = hir.int_to_ptr v297 : ptr; - hir.store v300, v263; - v830 = arith.constant 16 : i32; - v302 = arith.add v250, v830 : i32 #[overflow = wrapping]; + hir.store v300, v262; + v829 = arith.constant 16 : i32; + v302 = arith.add v249, v829 : i32 #[overflow = wrapping]; v303 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr v304 = hir.bitcast v303 : ptr; hir.store v304, v302; builtin.ret ; ^block43: - v829 = arith.constant 12 : u32; - v277 = hir.bitcast v250 : u32; - v279 = arith.add v277, v829 : u32 #[overflow = checked]; - v828 = arith.constant 4 : u32; - v281 = arith.mod v279, v828 : u32; - hir.assertz v281 #[code = 250]; - v282 = hir.int_to_ptr v279 : ptr; - v283 = hir.load v282 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::handle_error(v263, v283, v244) + v828 = arith.constant 12 : u32; + v276 = hir.bitcast v249 : u32; + v278 = arith.add v276, v828 : u32 #[overflow = checked]; + v827 = arith.constant 4 : u32; + v280 = arith.mod v278, v827 : u32; + hir.assertz v280 #[code = 250]; + v281 = hir.int_to_ptr v278 : ptr; + v282 = hir.load v281 : i32; + v283 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::handle_error(v262, v282, v283) ub.unreachable ; }; @@ -469,631 +470,630 @@ builtin.component root_ns:root@1.0.0 { v312 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr v313 = hir.bitcast v312 : ptr; hir.store v313, v311; - v318 = arith.constant 1048628 : i32; v316 = arith.constant 4 : i32; v314 = arith.constant 8 : i32; v315 = arith.add v311, v314 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::with_capacity_in(v315, v316, v316, v318) - v320 = arith.constant 8 : u32; - v319 = hir.bitcast v311 : u32; - v321 = arith.add v319, v320 : u32 #[overflow = checked]; - v322 = arith.constant 4 : u32; - v323 = arith.mod v321, v322 : u32; - hir.assertz v323 #[code = 250]; - v324 = hir.int_to_ptr v321 : ptr; - v325 = hir.load v324 : i32; - v327 = arith.constant 12 : u32; - v326 = hir.bitcast v311 : u32; - v328 = arith.add v326, v327 : u32 #[overflow = checked]; - v845 = arith.constant 4 : u32; - v330 = arith.mod v328, v845 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - v332 = hir.load v331 : i32; - v838 = arith.constant 2 : u32; - v334 = hir.bitcast v332 : u32; - v336 = arith.shr v334, v838 : u32; - v337 = hir.bitcast v336 : i32; - v338 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::active_note::get_inputs(v337) : i32 - v844 = arith.constant 8 : u32; - v339 = hir.bitcast v305 : u32; - v341 = arith.add v339, v844 : u32 #[overflow = checked]; - v843 = arith.constant 4 : u32; - v343 = arith.mod v341, v843 : u32; - hir.assertz v343 #[code = 250]; - v344 = hir.int_to_ptr v341 : ptr; - hir.store v344, v338; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::with_capacity_in(v315, v316, v316) + v319 = arith.constant 8 : u32; + v318 = hir.bitcast v311 : u32; + v320 = arith.add v318, v319 : u32 #[overflow = checked]; + v321 = arith.constant 4 : u32; + v322 = arith.mod v320, v321 : u32; + hir.assertz v322 #[code = 250]; + v323 = hir.int_to_ptr v320 : ptr; + v324 = hir.load v323 : i32; + v326 = arith.constant 12 : u32; + v325 = hir.bitcast v311 : u32; + v327 = arith.add v325, v326 : u32 #[overflow = checked]; + v844 = arith.constant 4 : u32; + v329 = arith.mod v327, v844 : u32; + hir.assertz v329 #[code = 250]; + v330 = hir.int_to_ptr v327 : ptr; + v331 = hir.load v330 : i32; + v837 = arith.constant 2 : u32; + v333 = hir.bitcast v331 : u32; + v335 = arith.shr v333, v837 : u32; + v336 = hir.bitcast v335 : i32; + v337 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::active_note::get_inputs(v336) : i32 + v843 = arith.constant 8 : u32; + v338 = hir.bitcast v305 : u32; + v340 = arith.add v338, v843 : u32 #[overflow = checked]; v842 = arith.constant 4 : u32; - v345 = hir.bitcast v305 : u32; - v347 = arith.add v345, v842 : u32 #[overflow = checked]; + v342 = arith.mod v340, v842 : u32; + hir.assertz v342 #[code = 250]; + v343 = hir.int_to_ptr v340 : ptr; + hir.store v343, v337; v841 = arith.constant 4 : u32; - v349 = arith.mod v347, v841 : u32; - hir.assertz v349 #[code = 250]; - v350 = hir.int_to_ptr v347 : ptr; - hir.store v350, v332; - v351 = hir.bitcast v305 : u32; + v344 = hir.bitcast v305 : u32; + v346 = arith.add v344, v841 : u32 #[overflow = checked]; v840 = arith.constant 4 : u32; - v353 = arith.mod v351, v840 : u32; - hir.assertz v353 #[code = 250]; - v354 = hir.int_to_ptr v351 : ptr; - hir.store v354, v325; - v839 = arith.constant 16 : i32; - v356 = arith.add v311, v839 : i32 #[overflow = wrapping]; - v357 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v358 = hir.bitcast v357 : ptr; - hir.store v358, v356; + v348 = arith.mod v346, v840 : u32; + hir.assertz v348 #[code = 250]; + v349 = hir.int_to_ptr v346 : ptr; + hir.store v349, v331; + v350 = hir.bitcast v305 : u32; + v839 = arith.constant 4 : u32; + v352 = arith.mod v350, v839 : u32; + hir.assertz v352 #[code = 250]; + v353 = hir.int_to_ptr v350 : ptr; + hir.store v353, v324; + v838 = arith.constant 16 : i32; + v355 = arith.add v311, v838 : i32 #[overflow = wrapping]; + v356 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v357 = hir.bitcast v356 : ptr; + hir.store v357, v355; builtin.ret ; }; - private builtin.function @>::from(v359: i32) -> felt { - ^block46(v359: i32): - v361 = hir.bitcast v359 : felt; - builtin.ret v361; + private builtin.function @>::from(v358: i32) -> felt { + ^block46(v358: i32): + v360 = hir.bitcast v358 : felt; + builtin.ret v360; }; - private builtin.function @intrinsics::felt::from_u32(v362: i32) -> felt { - ^block48(v362: i32): - v363 = hir.bitcast v362 : felt; - builtin.ret v363; + private builtin.function @intrinsics::felt::from_u32(v361: i32) -> felt { + ^block48(v361: i32): + v362 = hir.bitcast v361 : felt; + builtin.ret v362; }; - private builtin.function @intrinsics::felt::assert_eq(v365: felt, v366: felt) { - ^block50(v365: felt, v366: felt): - hir.assert_eq v365, v366; + private builtin.function @intrinsics::felt::assert_eq(v364: felt, v365: felt) { + ^block50(v364: felt, v365: felt): + hir.assert_eq v364, v365; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v367: i32, v368: i32, v369: i32) { - ^block52(v367: i32, v368: i32, v369: i32): - v371 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v372 = hir.bitcast v371 : ptr; - v373 = hir.load v372 : i32; - v374 = arith.constant 16 : i32; - v375 = arith.sub v373, v374 : i32 #[overflow = wrapping]; - v376 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v377 = hir.bitcast v376 : ptr; - hir.store v377, v375; - v378 = arith.constant 4 : i32; - v379 = arith.add v375, v378 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::current_memory(v379, v367, v368, v369) - v381 = arith.constant 8 : u32; - v380 = hir.bitcast v375 : u32; - v382 = arith.add v380, v381 : u32 #[overflow = checked]; - v383 = arith.constant 4 : u32; - v384 = arith.mod v382, v383 : u32; - hir.assertz v384 #[code = 250]; - v385 = hir.int_to_ptr v382 : ptr; - v386 = hir.load v385 : i32; - v852 = arith.constant 0 : i32; - v370 = arith.constant 0 : i32; - v388 = arith.eq v386, v370 : i1; - v389 = arith.zext v388 : u32; - v390 = hir.bitcast v389 : i32; - v392 = arith.neq v390, v852 : i1; - scf.if v392{ + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v366: i32, v367: i32, v368: i32) { + ^block52(v366: i32, v367: i32, v368: i32): + v370 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v371 = hir.bitcast v370 : ptr; + v372 = hir.load v371 : i32; + v373 = arith.constant 16 : i32; + v374 = arith.sub v372, v373 : i32 #[overflow = wrapping]; + v375 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v376 = hir.bitcast v375 : ptr; + hir.store v376, v374; + v377 = arith.constant 4 : i32; + v378 = arith.add v374, v377 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::current_memory(v378, v366, v367, v368) + v380 = arith.constant 8 : u32; + v379 = hir.bitcast v374 : u32; + v381 = arith.add v379, v380 : u32 #[overflow = checked]; + v382 = arith.constant 4 : u32; + v383 = arith.mod v381, v382 : u32; + hir.assertz v383 #[code = 250]; + v384 = hir.int_to_ptr v381 : ptr; + v385 = hir.load v384 : i32; + v851 = arith.constant 0 : i32; + v369 = arith.constant 0 : i32; + v387 = arith.eq v385, v369 : i1; + v388 = arith.zext v387 : u32; + v389 = hir.bitcast v388 : i32; + v391 = arith.neq v389, v851 : i1; + scf.if v391{ ^block135: scf.yield ; } else { ^block55: - v851 = arith.constant 4 : u32; - v393 = hir.bitcast v375 : u32; - v395 = arith.add v393, v851 : u32 #[overflow = checked]; v850 = arith.constant 4 : u32; - v397 = arith.mod v395, v850 : u32; - hir.assertz v397 #[code = 250]; - v398 = hir.int_to_ptr v395 : ptr; - v399 = hir.load v398 : i32; - v401 = arith.constant 12 : u32; - v400 = hir.bitcast v375 : u32; - v402 = arith.add v400, v401 : u32 #[overflow = checked]; + v392 = hir.bitcast v374 : u32; + v394 = arith.add v392, v850 : u32 #[overflow = checked]; v849 = arith.constant 4 : u32; - v404 = arith.mod v402, v849 : u32; - hir.assertz v404 #[code = 250]; - v405 = hir.int_to_ptr v402 : ptr; - v406 = hir.load v405 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v399, v386, v406) + v396 = arith.mod v394, v849 : u32; + hir.assertz v396 #[code = 250]; + v397 = hir.int_to_ptr v394 : ptr; + v398 = hir.load v397 : i32; + v400 = arith.constant 12 : u32; + v399 = hir.bitcast v374 : u32; + v401 = arith.add v399, v400 : u32 #[overflow = checked]; + v848 = arith.constant 4 : u32; + v403 = arith.mod v401, v848 : u32; + hir.assertz v403 #[code = 250]; + v404 = hir.int_to_ptr v401 : ptr; + v405 = hir.load v404 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v398, v385, v405) scf.yield ; }; - v848 = arith.constant 16 : i32; - v409 = arith.add v375, v848 : i32 #[overflow = wrapping]; - v410 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v411 = hir.bitcast v410 : ptr; - hir.store v411, v409; + v847 = arith.constant 16 : i32; + v408 = arith.add v374, v847 : i32 #[overflow = wrapping]; + v409 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v410 = hir.bitcast v409 : ptr; + hir.store v410, v408; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v412: i32, v413: i32, v414: i32, v415: i32, v416: i32) { - ^block56(v412: i32, v413: i32, v414: i32, v415: i32, v416: i32): - v419 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v420 = hir.bitcast v419 : ptr; - v421 = hir.load v420 : i32; - v422 = arith.constant 16 : i32; - v423 = arith.sub v421, v422 : i32 #[overflow = wrapping]; - v424 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v425 = hir.bitcast v424 : ptr; - hir.store v425, v423; - v435 = hir.bitcast v413 : u32; - v436 = arith.zext v435 : u64; - v437 = hir.bitcast v436 : i64; - v417 = arith.constant 0 : i32; - v430 = arith.sub v417, v415 : i32 #[overflow = wrapping]; - v427 = arith.constant -1 : i32; - v426 = arith.add v415, v416 : i32 #[overflow = wrapping]; - v428 = arith.add v426, v427 : i32 #[overflow = wrapping]; - v431 = arith.band v428, v430 : i32; - v432 = hir.bitcast v431 : u32; - v433 = arith.zext v432 : u64; - v434 = hir.bitcast v433 : i64; - v438 = arith.mul v434, v437 : i64 #[overflow = wrapping]; - v956 = arith.constant 0 : i32; - v439 = arith.constant 32 : i64; - v441 = hir.cast v439 : 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, v956 : i1; - v868, v869, v870, v871, v872, v873 = scf.if v446 : i32, i32, i32, i32, i32, u32 { + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v411: i32, v412: i32, v413: i32, v414: i32, v415: i32) { + ^block56(v411: i32, v412: i32, v413: i32, v414: i32, v415: i32): + v418 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v419 = hir.bitcast v418 : ptr; + v420 = hir.load v419 : i32; + v421 = arith.constant 16 : i32; + v422 = arith.sub v420, v421 : i32 #[overflow = wrapping]; + v423 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v424 = hir.bitcast v423 : ptr; + hir.store v424, v422; + v434 = hir.bitcast v412 : u32; + v435 = arith.zext v434 : u64; + v436 = hir.bitcast v435 : i64; + v416 = arith.constant 0 : i32; + v429 = arith.sub v416, v414 : i32 #[overflow = wrapping]; + v426 = arith.constant -1 : i32; + v425 = arith.add v414, v415 : i32 #[overflow = wrapping]; + v427 = arith.add v425, v426 : i32 #[overflow = wrapping]; + v430 = arith.band v427, v429 : i32; + v431 = hir.bitcast v430 : u32; + v432 = arith.zext v431 : u64; + v433 = hir.bitcast v432 : i64; + v437 = arith.mul v433, v436 : i64 #[overflow = wrapping]; + v955 = arith.constant 0 : i32; + v438 = arith.constant 32 : i64; + v440 = hir.cast v438 : u32; + v439 = hir.bitcast v437 : u64; + v441 = arith.shr v439, v440 : u64; + v442 = hir.bitcast v441 : i64; + v443 = arith.trunc v442 : i32; + v445 = arith.neq v443, v955 : i1; + v867, v868, v869, v870, v871, v872 = scf.if v445 : i32, i32, i32, i32, i32, u32 { ^block137: - v853 = arith.constant 0 : u32; - v860 = ub.poison i32 : i32; - scf.yield v412, v423, v860, v860, v860, v853; + v852 = arith.constant 0 : u32; + v859 = ub.poison i32 : i32; + scf.yield v411, v422, v859, v859, v859, v852; } else { ^block61: - v447 = arith.trunc v438 : i32; - v955 = arith.constant 0 : i32; - v448 = arith.constant -2147483648 : i32; - v449 = arith.sub v448, v415 : i32 #[overflow = wrapping]; - v451 = hir.bitcast v449 : u32; - v450 = hir.bitcast v447 : u32; - v452 = arith.lte v450, v451 : i1; - v453 = arith.zext v452 : u32; - v454 = hir.bitcast v453 : i32; - v456 = arith.neq v454, v955 : i1; - v916 = scf.if v456 : i32 { + v446 = arith.trunc v437 : i32; + v954 = arith.constant 0 : i32; + v447 = arith.constant -2147483648 : i32; + v448 = arith.sub v447, v414 : i32 #[overflow = wrapping]; + v450 = hir.bitcast v448 : u32; + v449 = hir.bitcast v446 : u32; + v451 = arith.lte v449, v450 : i1; + v452 = arith.zext v451 : u32; + v453 = hir.bitcast v452 : i32; + v455 = arith.neq v453, v954 : i1; + v915 = scf.if v455 : i32 { ^block59: - v954 = arith.constant 0 : i32; - v467 = arith.neq v447, v954 : i1; - v915 = scf.if v467 : i32 { + v953 = arith.constant 0 : i32; + v466 = arith.neq v446, v953 : i1; + v914 = scf.if v466 : i32 { ^block63: - v953 = arith.constant 0 : i32; - v483 = arith.neq v414, v953 : i1; - v914 = scf.if v483 : i32 { + v952 = arith.constant 0 : i32; + v482 = arith.neq v413, v952 : i1; + v913 = scf.if v482 : i32 { ^block66: - v465 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v423, v415, v447, v465) - v494 = hir.bitcast v423 : u32; - v539 = arith.constant 4 : u32; - v496 = arith.mod v494, v539 : u32; - hir.assertz v496 #[code = 250]; - v497 = hir.int_to_ptr v494 : ptr; - v498 = hir.load v497 : i32; - scf.yield v498; + v464 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v422, v414, v446, v464) + v493 = hir.bitcast v422 : u32; + v538 = arith.constant 4 : u32; + v495 = arith.mod v493, v538 : u32; + hir.assertz v495 #[code = 250]; + v496 = hir.int_to_ptr v493 : ptr; + v497 = hir.load v496 : i32; + scf.yield v497; } else { ^block67: - v484 = arith.constant 8 : i32; - v485 = arith.add v423, v484 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v485, v415, v447) - v469 = arith.constant 8 : u32; - v486 = hir.bitcast v423 : u32; - v488 = arith.add v486, v469 : u32 #[overflow = checked]; - v952 = arith.constant 4 : u32; - v490 = arith.mod v488, v952 : u32; - hir.assertz v490 #[code = 250]; - v491 = hir.int_to_ptr v488 : ptr; - v492 = hir.load v491 : i32; - scf.yield v492; + v483 = arith.constant 8 : i32; + v484 = arith.add v422, v483 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v484, v414, v446) + v468 = arith.constant 8 : u32; + v485 = hir.bitcast v422 : u32; + v487 = arith.add v485, v468 : u32 #[overflow = checked]; + v951 = arith.constant 4 : u32; + v489 = arith.mod v487, v951 : u32; + hir.assertz v489 #[code = 250]; + v490 = hir.int_to_ptr v487 : ptr; + v491 = hir.load v490 : i32; + scf.yield v491; }; + v949 = arith.constant 0 : i32; v950 = arith.constant 0 : i32; - v951 = arith.constant 0 : i32; - v501 = arith.eq v914, v951 : i1; - v502 = arith.zext v501 : u32; - v503 = hir.bitcast v502 : i32; - v505 = arith.neq v503, v950 : i1; - scf.if v505{ + v500 = arith.eq v913, v950 : i1; + v501 = arith.zext v500 : u32; + v502 = hir.bitcast v501 : i32; + v504 = arith.neq v502, v949 : i1; + scf.if v504{ ^block68: - v949 = arith.constant 8 : u32; - v522 = hir.bitcast v412 : u32; - v524 = arith.add v522, v949 : u32 #[overflow = checked]; - v948 = arith.constant 4 : u32; - v526 = arith.mod v524, v948 : u32; - hir.assertz v526 #[code = 250]; - v527 = hir.int_to_ptr v524 : ptr; - hir.store v527, v447; + v948 = arith.constant 8 : u32; + v521 = hir.bitcast v411 : u32; + v523 = arith.add v521, v948 : u32 #[overflow = checked]; v947 = arith.constant 4 : u32; - v529 = hir.bitcast v412 : u32; - v531 = arith.add v529, v947 : u32 #[overflow = checked]; + v525 = arith.mod v523, v947 : u32; + hir.assertz v525 #[code = 250]; + v526 = hir.int_to_ptr v523 : ptr; + hir.store v526, v446; v946 = arith.constant 4 : u32; - v533 = arith.mod v531, v946 : u32; - hir.assertz v533 #[code = 250]; - v534 = hir.int_to_ptr v531 : ptr; - hir.store v534, v415; + v528 = hir.bitcast v411 : u32; + v530 = arith.add v528, v946 : u32 #[overflow = checked]; + v945 = arith.constant 4 : u32; + v532 = arith.mod v530, v945 : u32; + hir.assertz v532 #[code = 250]; + v533 = hir.int_to_ptr v530 : ptr; + hir.store v533, v414; scf.yield ; } else { ^block69: - v945 = arith.constant 8 : u32; - v507 = hir.bitcast v412 : u32; - v509 = arith.add v507, v945 : u32 #[overflow = checked]; - v944 = arith.constant 4 : u32; - v511 = arith.mod v509, v944 : u32; - hir.assertz v511 #[code = 250]; - v512 = hir.int_to_ptr v509 : ptr; - hir.store v512, v914; + v944 = arith.constant 8 : u32; + v506 = hir.bitcast v411 : u32; + v508 = arith.add v506, v944 : u32 #[overflow = checked]; v943 = arith.constant 4 : u32; - v514 = hir.bitcast v412 : u32; - v516 = arith.add v514, v943 : u32 #[overflow = checked]; + v510 = arith.mod v508, v943 : u32; + hir.assertz v510 #[code = 250]; + v511 = hir.int_to_ptr v508 : ptr; + hir.store v511, v913; v942 = arith.constant 4 : u32; - v518 = arith.mod v516, v942 : u32; - hir.assertz v518 #[code = 250]; - v519 = hir.int_to_ptr v516 : ptr; - hir.store v519, v413; + v513 = hir.bitcast v411 : u32; + v515 = arith.add v513, v942 : u32 #[overflow = checked]; + v941 = arith.constant 4 : u32; + v517 = arith.mod v515, v941 : u32; + hir.assertz v517 #[code = 250]; + v518 = hir.int_to_ptr v515 : ptr; + hir.store v518, v412; scf.yield ; }; - v940 = arith.constant 0 : i32; - v941 = arith.constant 1 : i32; - v913 = cf.select v505, v941, v940 : i32; - scf.yield v913; + v939 = arith.constant 0 : i32; + v940 = arith.constant 1 : i32; + v912 = cf.select v504, v940, v939 : i32; + scf.yield v912; } else { ^block64: - v939 = arith.constant 8 : u32; - v468 = hir.bitcast v412 : u32; - v470 = arith.add v468, v939 : u32 #[overflow = checked]; - v938 = arith.constant 4 : u32; - v472 = arith.mod v470, v938 : u32; - hir.assertz v472 #[code = 250]; - v473 = hir.int_to_ptr v470 : ptr; - hir.store v473, v415; + v938 = arith.constant 8 : u32; + v467 = hir.bitcast v411 : u32; + v469 = arith.add v467, v938 : u32 #[overflow = checked]; v937 = arith.constant 4 : u32; - v476 = hir.bitcast v412 : u32; - v478 = arith.add v476, v937 : u32 #[overflow = checked]; + v471 = arith.mod v469, v937 : u32; + hir.assertz v471 #[code = 250]; + v472 = hir.int_to_ptr v469 : ptr; + hir.store v472, v414; v936 = arith.constant 4 : u32; - v480 = arith.mod v478, v936 : u32; - hir.assertz v480 #[code = 250]; - v935 = arith.constant 0 : i32; - v481 = hir.int_to_ptr v478 : ptr; - hir.store v481, v935; + v475 = hir.bitcast v411 : u32; + v477 = arith.add v475, v936 : u32 #[overflow = checked]; + v935 = arith.constant 4 : u32; + v479 = arith.mod v477, v935 : u32; + hir.assertz v479 #[code = 250]; v934 = arith.constant 0 : i32; - scf.yield v934; + v480 = hir.int_to_ptr v477 : ptr; + hir.store v480, v934; + v933 = arith.constant 0 : i32; + scf.yield v933; }; - scf.yield v915; + scf.yield v914; } else { ^block62: - v933 = ub.poison i32 : i32; - scf.yield v933; + v932 = ub.poison i32 : i32; + scf.yield v932; }; - v928 = arith.constant 0 : u32; - v861 = arith.constant 1 : u32; - v921 = cf.select v456, v861, v928 : u32; + v927 = arith.constant 0 : u32; + v860 = arith.constant 1 : u32; + v920 = cf.select v455, v860, v927 : u32; + v928 = ub.poison i32 : i32; + v919 = cf.select v455, v422, v928 : i32; v929 = ub.poison i32 : i32; - v920 = cf.select v456, v423, v929 : i32; + v918 = cf.select v455, v411, v929 : i32; v930 = ub.poison i32 : i32; - v919 = cf.select v456, v412, v930 : i32; + v917 = cf.select v455, v930, v422 : i32; v931 = ub.poison i32 : i32; - v918 = cf.select v456, v931, v423 : i32; - v932 = ub.poison i32 : i32; - v917 = cf.select v456, v932, v412 : i32; - scf.yield v917, v918, v919, v916, v920, v921; + v916 = cf.select v455, v931, v411 : i32; + scf.yield v916, v917, v918, v915, v919, v920; }; - v874, v875, v876 = scf.index_switch v873 : i32, i32, i32 + v873, v874, v875 = scf.index_switch v872 : i32, i32, i32 case 0 { ^block60: - v927 = arith.constant 4 : u32; - v459 = hir.bitcast v868 : u32; - v461 = arith.add v459, v927 : u32 #[overflow = checked]; v926 = arith.constant 4 : u32; - v463 = arith.mod v461, v926 : u32; - hir.assertz v463 #[code = 250]; - v925 = arith.constant 0 : i32; - v464 = hir.int_to_ptr v461 : ptr; - hir.store v464, v925; - v924 = arith.constant 1 : i32; - scf.yield v868, v924, v869; + v458 = hir.bitcast v867 : u32; + v460 = arith.add v458, v926 : u32 #[overflow = checked]; + v925 = arith.constant 4 : u32; + v462 = arith.mod v460, v925 : u32; + hir.assertz v462 #[code = 250]; + v924 = arith.constant 0 : i32; + v463 = hir.int_to_ptr v460 : ptr; + hir.store v463, v924; + v923 = arith.constant 1 : i32; + scf.yield v867, v923, v868; } default { ^block141: - scf.yield v870, v871, v872; + scf.yield v869, v870, v871; }; - v538 = hir.bitcast v874 : u32; - v923 = arith.constant 4 : u32; - v540 = arith.mod v538, v923 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - hir.store v541, v875; - v922 = arith.constant 16 : i32; - v546 = arith.add v876, v922 : i32 #[overflow = wrapping]; - v547 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v548 = hir.bitcast v547 : ptr; - hir.store v548, v546; + v537 = hir.bitcast v873 : u32; + v922 = arith.constant 4 : u32; + v539 = arith.mod v537, v922 : u32; + hir.assertz v539 #[code = 250]; + v540 = hir.int_to_ptr v537 : ptr; + hir.store v540, v874; + v921 = arith.constant 16 : i32; + v545 = arith.add v875, v921 : i32 #[overflow = wrapping]; + v546 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v547 = hir.bitcast v546 : ptr; + hir.store v547, v545; builtin.ret ; }; - private builtin.function @::allocate(v549: i32, v550: i32, v551: i32) { - ^block70(v549: i32, v550: i32, v551: i32): - v553 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v554 = hir.bitcast v553 : ptr; - v555 = hir.load v554 : i32; - v556 = arith.constant 16 : i32; - v557 = arith.sub v555, v556 : i32 #[overflow = wrapping]; - v558 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v559 = hir.bitcast v558 : ptr; - hir.store v559, v557; - v552 = arith.constant 0 : i32; - v560 = arith.constant 8 : i32; - v561 = arith.add v557, v560 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v561, v550, v551, v552) - v564 = arith.constant 12 : u32; - v563 = hir.bitcast v557 : u32; - v565 = arith.add v563, v564 : u32 #[overflow = checked]; - v566 = arith.constant 4 : u32; - v567 = arith.mod v565, v566 : u32; - hir.assertz v567 #[code = 250]; - v568 = hir.int_to_ptr v565 : ptr; - v569 = hir.load v568 : i32; - v571 = arith.constant 8 : u32; - v570 = hir.bitcast v557 : u32; - v572 = arith.add v570, v571 : u32 #[overflow = checked]; - v961 = arith.constant 4 : u32; - v574 = arith.mod v572, v961 : u32; - hir.assertz v574 #[code = 250]; - v575 = hir.int_to_ptr v572 : ptr; - v576 = hir.load v575 : i32; - v577 = hir.bitcast v549 : u32; + private builtin.function @::allocate(v548: i32, v549: i32, v550: i32) { + ^block70(v548: i32, v549: i32, v550: i32): + v552 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v553 = hir.bitcast v552 : ptr; + v554 = hir.load v553 : i32; + v555 = arith.constant 16 : i32; + v556 = arith.sub v554, v555 : i32 #[overflow = wrapping]; + v557 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v558 = hir.bitcast v557 : ptr; + hir.store v558, v556; + v551 = arith.constant 0 : i32; + v559 = arith.constant 8 : i32; + v560 = arith.add v556, v559 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v560, v549, v550, v551) + v563 = arith.constant 12 : u32; + v562 = hir.bitcast v556 : u32; + v564 = arith.add v562, v563 : u32 #[overflow = checked]; + v565 = arith.constant 4 : u32; + v566 = arith.mod v564, v565 : u32; + hir.assertz v566 #[code = 250]; + v567 = hir.int_to_ptr v564 : ptr; + v568 = hir.load v567 : i32; + v570 = arith.constant 8 : u32; + v569 = hir.bitcast v556 : u32; + v571 = arith.add v569, v570 : u32 #[overflow = checked]; v960 = arith.constant 4 : u32; - v579 = arith.mod v577, v960 : u32; - hir.assertz v579 #[code = 250]; - v580 = hir.int_to_ptr v577 : ptr; - hir.store v580, v576; + v573 = arith.mod v571, v960 : u32; + hir.assertz v573 #[code = 250]; + v574 = hir.int_to_ptr v571 : ptr; + v575 = hir.load v574 : i32; + v576 = hir.bitcast v548 : u32; v959 = arith.constant 4 : u32; - v581 = hir.bitcast v549 : u32; - v583 = arith.add v581, v959 : u32 #[overflow = checked]; + v578 = arith.mod v576, v959 : u32; + hir.assertz v578 #[code = 250]; + v579 = hir.int_to_ptr v576 : ptr; + hir.store v579, v575; v958 = arith.constant 4 : u32; - v585 = arith.mod v583, v958 : u32; - hir.assertz v585 #[code = 250]; - v586 = hir.int_to_ptr v583 : ptr; - hir.store v586, v569; - v957 = arith.constant 16 : i32; - v588 = arith.add v557, v957 : i32 #[overflow = wrapping]; - v589 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v590 = hir.bitcast v589 : ptr; - hir.store v590, v588; + v580 = hir.bitcast v548 : u32; + v582 = arith.add v580, v958 : u32 #[overflow = checked]; + v957 = arith.constant 4 : u32; + v584 = arith.mod v582, v957 : u32; + hir.assertz v584 #[code = 250]; + v585 = hir.int_to_ptr v582 : ptr; + hir.store v585, v568; + v956 = arith.constant 16 : i32; + v587 = arith.add v556, v956 : i32 #[overflow = wrapping]; + v588 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v589 = hir.bitcast v588 : ptr; + hir.store v589, v587; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v591: i32, v592: i32, v593: i32, v594: i32) { - ^block72(v591: i32, v592: i32, v593: i32, v594: i32): - v977 = arith.constant 0 : i32; - v595 = arith.constant 0 : i32; - v596 = arith.eq v593, v595 : i1; - v597 = arith.zext v596 : u32; - v598 = hir.bitcast v597 : i32; - v600 = arith.neq v598, v977 : i1; - v973 = scf.if v600 : i32 { + private builtin.function @alloc::alloc::Global::alloc_impl(v590: i32, v591: i32, v592: i32, v593: i32) { + ^block72(v590: i32, v591: i32, v592: i32, v593: i32): + v976 = arith.constant 0 : i32; + v594 = arith.constant 0 : i32; + v595 = arith.eq v592, v594 : i1; + v596 = arith.zext v595 : u32; + v597 = hir.bitcast v596 : i32; + v599 = arith.neq v597, v976 : i1; + v972 = scf.if v599 : i32 { ^block144: - scf.yield v592; + scf.yield v591; } else { ^block75: hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v976 = arith.constant 0 : i32; - v602 = arith.neq v594, v976 : i1; - v972 = scf.if v602 : i32 { + v975 = arith.constant 0 : i32; + v601 = arith.neq v593, v975 : i1; + v971 = scf.if v601 : i32 { ^block76: - v604 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v593, v592) : i32 - scf.yield v604; + v603 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v592, v591) : i32 + scf.yield v603; } else { ^block77: - v603 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v593, v592) : i32 - scf.yield v603; + v602 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v592, v591) : i32 + scf.yield v602; }; - scf.yield v972; + scf.yield v971; }; - v608 = arith.constant 4 : u32; - v607 = hir.bitcast v591 : u32; - v609 = arith.add v607, v608 : u32 #[overflow = checked]; - v975 = arith.constant 4 : u32; - v611 = arith.mod v609, v975 : u32; - hir.assertz v611 #[code = 250]; - v612 = hir.int_to_ptr v609 : ptr; - hir.store v612, v593; - v614 = hir.bitcast v591 : u32; + v607 = arith.constant 4 : u32; + v606 = hir.bitcast v590 : u32; + v608 = arith.add v606, v607 : u32 #[overflow = checked]; v974 = arith.constant 4 : u32; - v616 = arith.mod v614, v974 : u32; - hir.assertz v616 #[code = 250]; - v617 = hir.int_to_ptr v614 : ptr; - hir.store v617, v973; + v610 = arith.mod v608, v974 : u32; + hir.assertz v610 #[code = 250]; + v611 = hir.int_to_ptr v608 : ptr; + hir.store v611, v592; + v613 = hir.bitcast v590 : u32; + v973 = arith.constant 4 : u32; + v615 = arith.mod v613, v973 : u32; + hir.assertz v615 #[code = 250]; + v616 = hir.int_to_ptr v613 : ptr; + hir.store v616, v972; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v618: i32, v619: i32, v620: i32, v621: i32) { - ^block78(v618: i32, v619: i32, v620: i32, v621: i32): - v1003 = arith.constant 0 : i32; - v622 = arith.constant 0 : i32; - v626 = arith.eq v621, v622 : i1; - v627 = arith.zext v626 : u32; - v628 = hir.bitcast v627 : i32; - v630 = arith.neq v628, v1003 : i1; - v990, v991 = scf.if v630 : i32, i32 { + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v617: i32, v618: i32, v619: i32, v620: i32) { + ^block78(v617: i32, v618: i32, v619: i32, v620: i32): + v1002 = arith.constant 0 : i32; + v621 = arith.constant 0 : i32; + v625 = arith.eq v620, v621 : i1; + v626 = arith.zext v625 : u32; + v627 = hir.bitcast v626 : i32; + v629 = arith.neq v627, v1002 : i1; + v989, v990 = scf.if v629 : i32, i32 { ^block148: - v1002 = arith.constant 0 : i32; - v624 = arith.constant 4 : i32; - scf.yield v624, v1002; + v1001 = arith.constant 0 : i32; + v623 = arith.constant 4 : i32; + scf.yield v623, v1001; } else { ^block81: - v631 = hir.bitcast v619 : u32; - v666 = arith.constant 4 : u32; - v633 = arith.mod v631, v666 : u32; - hir.assertz v633 #[code = 250]; - v634 = hir.int_to_ptr v631 : ptr; - v635 = hir.load v634 : i32; + v630 = hir.bitcast v618 : u32; + v665 = arith.constant 4 : u32; + v632 = arith.mod v630, v665 : u32; + hir.assertz v632 #[code = 250]; + v633 = hir.int_to_ptr v630 : ptr; + v634 = hir.load v633 : i32; + v999 = arith.constant 0 : i32; v1000 = arith.constant 0 : i32; - v1001 = arith.constant 0 : i32; - v637 = arith.eq v635, v1001 : i1; - v638 = arith.zext v637 : u32; - v639 = hir.bitcast v638 : i32; - v641 = arith.neq v639, v1000 : i1; - v988 = scf.if v641 : i32 { + v636 = arith.eq v634, v1000 : i1; + v637 = arith.zext v636 : u32; + v638 = hir.bitcast v637 : i32; + v640 = arith.neq v638, v999 : i1; + v987 = scf.if v640 : i32 { ^block147: - v999 = arith.constant 0 : i32; - scf.yield v999; + v998 = arith.constant 0 : i32; + scf.yield v998; } else { ^block82: - v998 = arith.constant 4 : u32; - v642 = hir.bitcast v618 : u32; - v644 = arith.add v642, v998 : u32 #[overflow = checked]; v997 = arith.constant 4 : u32; - v646 = arith.mod v644, v997 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - hir.store v647, v620; + v641 = hir.bitcast v617 : u32; + v643 = arith.add v641, v997 : u32 #[overflow = checked]; v996 = arith.constant 4 : u32; - v648 = hir.bitcast v619 : u32; - v650 = arith.add v648, v996 : u32 #[overflow = checked]; + v645 = arith.mod v643, v996 : u32; + hir.assertz v645 #[code = 250]; + v646 = hir.int_to_ptr v643 : ptr; + hir.store v646, v619; v995 = arith.constant 4 : u32; - v652 = arith.mod v650, v995 : u32; - hir.assertz v652 #[code = 250]; - v653 = hir.int_to_ptr v650 : ptr; - v654 = hir.load v653 : i32; - v655 = hir.bitcast v618 : u32; + v647 = hir.bitcast v618 : u32; + v649 = arith.add v647, v995 : u32 #[overflow = checked]; v994 = arith.constant 4 : u32; - v657 = arith.mod v655, v994 : u32; - hir.assertz v657 #[code = 250]; - v658 = hir.int_to_ptr v655 : ptr; - hir.store v658, v654; - v659 = arith.mul v635, v621 : i32 #[overflow = wrapping]; - scf.yield v659; + v651 = arith.mod v649, v994 : u32; + hir.assertz v651 #[code = 250]; + v652 = hir.int_to_ptr v649 : ptr; + v653 = hir.load v652 : i32; + v654 = hir.bitcast v617 : u32; + v993 = arith.constant 4 : u32; + v656 = arith.mod v654, v993 : u32; + hir.assertz v656 #[code = 250]; + v657 = hir.int_to_ptr v654 : ptr; + hir.store v657, v653; + v658 = arith.mul v634, v620 : i32 #[overflow = wrapping]; + scf.yield v658; }; - v660 = arith.constant 8 : i32; - v993 = arith.constant 4 : i32; - v989 = cf.select v641, v993, v660 : i32; - scf.yield v989, v988; + v659 = arith.constant 8 : i32; + v992 = arith.constant 4 : i32; + v988 = cf.select v640, v992, v659 : i32; + scf.yield v988, v987; }; - v663 = arith.add v618, v990 : i32 #[overflow = wrapping]; - v665 = hir.bitcast v663 : u32; - v992 = arith.constant 4 : u32; - v667 = arith.mod v665, v992 : u32; - hir.assertz v667 #[code = 250]; - v668 = hir.int_to_ptr v665 : ptr; - hir.store v668, v991; + v662 = arith.add v617, v989 : i32 #[overflow = wrapping]; + v664 = hir.bitcast v662 : u32; + v991 = arith.constant 4 : u32; + v666 = arith.mod v664, v991 : u32; + hir.assertz v666 #[code = 250]; + v667 = hir.int_to_ptr v664 : ptr; + hir.store v667, v990; builtin.ret ; }; - private builtin.function @::deallocate(v669: i32, v670: i32, v671: i32) { - ^block83(v669: i32, v670: i32, v671: i32): - v1005 = arith.constant 0 : i32; - v672 = arith.constant 0 : i32; - v673 = arith.eq v671, v672 : i1; - v674 = arith.zext v673 : u32; - v675 = hir.bitcast v674 : i32; - v677 = arith.neq v675, v1005 : i1; - scf.if v677{ + private builtin.function @::deallocate(v668: i32, v669: i32, v670: i32) { + ^block83(v668: i32, v669: i32, v670: i32): + v1004 = arith.constant 0 : i32; + v671 = arith.constant 0 : i32; + v672 = arith.eq v670, v671 : i1; + v673 = arith.zext v672 : u32; + v674 = hir.bitcast v673 : i32; + v676 = arith.neq v674, v1004 : i1; + scf.if v676{ ^block85: scf.yield ; } else { ^block86: - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v669, v671, v670) + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v668, v670, v669) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v678: i32, v679: i32, v680: i32) { - ^block87(v678: i32, v679: i32, v680: i32): + private builtin.function @alloc::raw_vec::handle_error(v677: i32, v678: i32, v679: i32) { + ^block87(v677: i32, v678: i32, v679: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v681: i32, v682: i32) -> i32 { - ^block89(v681: i32, v682: i32): - v689 = arith.constant 0 : i32; - v685 = hir.bitcast v682 : u32; + private builtin.function @core::ptr::alignment::Alignment::max(v680: i32, v681: i32) -> i32 { + ^block89(v680: i32, v681: i32): + v688 = arith.constant 0 : i32; v684 = hir.bitcast v681 : u32; - v686 = arith.gt v684, v685 : i1; - v687 = arith.zext v686 : u32; - v688 = hir.bitcast v687 : i32; - v690 = arith.neq v688, v689 : i1; - v691 = cf.select v690, v681, v682 : i32; - builtin.ret v691; + v683 = hir.bitcast v680 : u32; + v685 = arith.gt v683, v684 : i1; + v686 = arith.zext v685 : u32; + v687 = hir.bitcast v686 : i32; + v689 = arith.neq v687, v688 : i1; + v690 = cf.select v689, v680, v681 : i32; + builtin.ret v690; }; - private builtin.function @miden::active_note::get_inputs(v692: i32) -> i32 { - ^block91(v692: i32): - v693, v694 = hir.exec @miden/active_note/get_inputs(v692) : i32, i32 - builtin.ret v693; + private builtin.function @miden::active_note::get_inputs(v691: i32) -> i32 { + ^block91(v691: i32): + v692, v693 = hir.exec @miden/active_note/get_inputs(v691) : i32, i32 + builtin.ret v692; }; - public builtin.function @cabi_realloc(v696: i32, v697: i32, v698: i32, v699: i32) -> i32 { - ^block95(v696: i32, v697: i32, v698: i32, v699: i32): - v701 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/cabi_realloc_wit_bindgen_0_46_0(v696, v697, v698, v699) : i32 - builtin.ret v701; + public builtin.function @cabi_realloc(v695: i32, v696: i32, v697: i32, v698: i32) -> i32 { + ^block95(v695: i32, v696: i32, v697: i32, v698: i32): + v700 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/cabi_realloc_wit_bindgen_0_46_0(v695, v696, v697, v698) : i32 + builtin.ret v700; }; - private builtin.function @alloc::alloc::alloc(v702: i32, v703: i32) -> i32 { - ^block97(v702: i32, v703: i32): + private builtin.function @alloc::alloc::alloc(v701: i32, v702: i32) -> i32 { + ^block97(v701: i32, v702: i32): hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v705 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v703, v702) : i32 - builtin.ret v705; + v704 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v702, v701) : i32 + builtin.ret v704; }; - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v706: i32, v707: i32, v708: i32, v709: i32) -> i32 { - ^block99(v706: i32, v707: i32, v708: i32, v709: i32): - v711 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/wit_bindgen::rt::cabi_realloc(v706, v707, v708, v709) : i32 - builtin.ret v711; + public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v705: i32, v706: i32, v707: i32, v708: i32) -> i32 { + ^block99(v705: i32, v706: i32, v707: i32, v708: i32): + v710 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/wit_bindgen::rt::cabi_realloc(v705, v706, v707, v708) : i32 + builtin.ret v710; }; - private builtin.function @wit_bindgen::rt::cabi_realloc(v712: i32, v713: i32, v714: i32, v715: i32) -> i32 { - ^block101(v712: i32, v713: i32, v714: i32, v715: i32): - v717 = arith.constant 0 : i32; - v718 = arith.neq v713, v717 : i1; - v1016, v1017, v1018 = scf.if v718 : i32, i32, u32 { + private builtin.function @wit_bindgen::rt::cabi_realloc(v711: i32, v712: i32, v713: i32, v714: i32) -> i32 { + ^block101(v711: i32, v712: i32, v713: i32, v714: i32): + v716 = arith.constant 0 : i32; + v717 = arith.neq v712, v716 : i1; + v1015, v1016, v1017 = scf.if v717 : i32, i32, u32 { ^block105: - v726 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_realloc(v712, v713, v714, v715) : i32 - v1007 = arith.constant 0 : u32; - v1011 = ub.poison i32 : i32; - scf.yield v726, v1011, v1007; + v725 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_realloc(v711, v712, v713, v714) : i32 + v1006 = arith.constant 0 : u32; + v1010 = ub.poison i32 : i32; + scf.yield v725, v1010, v1006; } else { ^block106: + v1045 = arith.constant 0 : i32; v1046 = arith.constant 0 : i32; - v1047 = arith.constant 0 : i32; - v720 = arith.eq v715, v1047 : i1; - v721 = arith.zext v720 : u32; - v722 = hir.bitcast v721 : i32; - v724 = arith.neq v722, v1046 : i1; - v1034 = scf.if v724 : i32 { + v719 = arith.eq v714, v1046 : i1; + v720 = arith.zext v719 : u32; + v721 = hir.bitcast v720 : i32; + v723 = arith.neq v721, v1045 : i1; + v1033 = scf.if v723 : i32 { ^block152: - v1045 = ub.poison i32 : i32; - scf.yield v1045; + v1044 = ub.poison i32 : i32; + scf.yield v1044; } else { ^block107: - v725 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::alloc(v714, v715) : i32 - scf.yield v725; + v724 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::alloc(v713, v714) : i32 + scf.yield v724; }; - v1043 = arith.constant 0 : u32; - v1012 = arith.constant 1 : u32; - v1036 = cf.select v724, v1012, v1043 : u32; - v1044 = ub.poison i32 : i32; - v1035 = cf.select v724, v714, v1044 : i32; - scf.yield v1034, v1035, v1036; + v1042 = arith.constant 0 : u32; + v1011 = arith.constant 1 : u32; + v1035 = cf.select v723, v1011, v1042 : u32; + v1043 = ub.poison i32 : i32; + v1034 = cf.select v723, v713, v1043 : i32; + scf.yield v1033, v1034, v1035; }; - v1023, v1024 = scf.index_switch v1018 : i32, u32 + v1022, v1023 = scf.index_switch v1017 : i32, u32 case 0 { ^block104: - v1041 = arith.constant 0 : i32; - v729 = arith.neq v1016, v1041 : i1; - v1038 = arith.constant 1 : u32; - v1039 = arith.constant 0 : u32; - v1033 = cf.select v729, v1039, v1038 : u32; - v1040 = ub.poison i32 : i32; - v1032 = cf.select v729, v1016, v1040 : i32; - scf.yield v1032, v1033; + v1040 = arith.constant 0 : i32; + v728 = arith.neq v1015, v1040 : i1; + v1037 = arith.constant 1 : u32; + v1038 = arith.constant 0 : u32; + v1032 = cf.select v728, v1038, v1037 : u32; + v1039 = ub.poison i32 : i32; + v1031 = cf.select v728, v1015, v1039 : i32; + scf.yield v1031, v1032; } default { ^block159: - v1042 = arith.constant 0 : u32; - scf.yield v1017, v1042; + v1041 = arith.constant 0 : u32; + scf.yield v1016, v1041; }; - v1037 = arith.constant 0 : u32; - v1031 = arith.eq v1024, v1037 : i1; - cf.cond_br v1031 ^block154, ^block155; + v1036 = arith.constant 0 : u32; + v1030 = arith.eq v1023, v1036 : i1; + cf.cond_br v1030 ^block154, ^block155; ^block154: - builtin.ret v1023; + builtin.ret v1022; ^block155: ub.unreachable ; }; @@ -1102,6 +1102,6 @@ builtin.component root_ns:root@1.0.0 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x00000001000000210000001f00000030001000000000000073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x0000000100000000000000000000000a0010000000003e64657463616465723c; }; }; \ 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 index 88710f762..dac677b53 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm @@ -5,17 +5,17 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[1554473420111659168,832244429625754668,5418308924757320907,17702588667154917010] + push.[13303268137284580667,14000914427208839465,16230032807968224336,7923152364088757166] adv.push_mapval push.262144 - push.5 + push.2 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278552 + mem_store.278536 end # mod root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4 @@ -24,7 +24,7 @@ end pub proc entrypoint( ) - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -34,7 +34,7 @@ pub proc entrypoint( nop push.16 u32wrapping_sub - push.1114208 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -276,7 +276,7 @@ pub proc entrypoint( push.16 movup.2 u32wrapping_add - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -304,7 +304,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048648 + push.1048608 movup.2 swap.1 trace.240 @@ -323,7 +323,7 @@ end @callconv("C") proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048648 + push.1048608 dup.4 swap.2 swap.4 @@ -427,7 +427,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048648 + push.1048608 dup.1 swap.2 swap.3 @@ -701,12 +701,11 @@ end @callconv("C") proc alloc::raw_vec::RawVecInner::with_capacity_in( - i32, i32, i32, i32 ) - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -716,7 +715,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -782,8 +781,6 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( neq neq if.true - movup.3 - drop push.12 dup.2 add @@ -834,7 +831,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -862,7 +859,8 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 + push.1048588 + swap.2 trace.240 nop exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::raw_vec::handle_error @@ -877,7 +875,7 @@ end proc miden_base_sys::bindings::active_note::get_inputs( i32 ) - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -887,7 +885,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop push.16 u32wrapping_sub - push.1114208 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -897,10 +895,9 @@ proc miden_base_sys::bindings::active_note::get_inputs( exec.::intrinsics::mem::store_sw trace.252 nop - push.1048628 push.4 push.8 - dup.3 + dup.2 u32wrapping_add dup.1 swap.2 @@ -1003,7 +1000,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop push.16 u32wrapping_add - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1036,7 +1033,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( i32, i32 ) - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1046,7 +1043,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1137,7 +1134,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1155,7 +1152,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1165,7 +1162,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1550,7 +1547,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1566,7 +1563,7 @@ proc ::allocate( i32, i32 ) - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1576,7 +1573,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1669,7 +1666,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114208 + push.1114144 u32divmod.4 swap.1 trace.240 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 index 018214241..8191e94d9 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat @@ -5,11 +5,11 @@ (type (;3;) (func (param i32 i32 i32 i32) (result i32))) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) - (type (;6;) (func (param i32 i32 i32 i32))) - (type (;7;) (func (param i32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param f32 f32))) - (type (;10;) (func (param i32 i32 i32 i32 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 i32))) + (type (;10;) (func (param i32 i32 i32 i32))) (type (;11;) (func (param i32) (result i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -90,7 +90,7 @@ unreachable ) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) - i32.const 1048648 + i32.const 1048608 local.get 1 local.get 0 call $::alloc @@ -98,7 +98,7 @@ (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) (func $__rustc::__rust_realloc (;3;) (type 3) (param i32 i32 i32 i32) (result i32) block ;; label = @1 - i32.const 1048648 + i32.const 1048608 local.get 2 local.get 3 call $::alloc @@ -123,7 +123,7 @@ ) (func $__rustc::__rust_alloc_zeroed (;4;) (type 1) (param i32 i32) (result i32) block ;; label = @1 - i32.const 1048648 + i32.const 1048608 local.get 1 local.get 0 call $::alloc @@ -218,14 +218,14 @@ (func $intrinsics::mem::heap_base (;7;) (type 5) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;8;) (type 6) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;8;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 4 + local.tee 3 global.set $__stack_pointer - local.get 4 + local.get 3 i32.const 4 i32.add i32.const 256 @@ -233,35 +233,35 @@ local.get 1 local.get 2 call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 4 + local.get 3 i32.load offset=8 local.set 2 block ;; label = @1 - local.get 4 + local.get 3 i32.load offset=4 i32.const 1 i32.ne br_if 0 (;@1;) local.get 2 - local.get 4 - i32.load offset=12 local.get 3 + i32.load offset=12 + i32.const 1048588 call $alloc::raw_vec::handle_error unreachable end local.get 0 - local.get 4 + local.get 3 i32.load offset=12 i32.store offset=4 local.get 0 local.get 2 i32.store - local.get 4 + local.get 3 i32.const 16 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_inputs (;9;) (type 7) (param i32) + (func $miden_base_sys::bindings::active_note::get_inputs (;9;) (type 6) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -273,7 +273,6 @@ i32.add i32.const 4 i32.const 4 - i32.const 1048628 call $alloc::raw_vec::RawVecInner::with_capacity_in local.get 1 i32.load offset=8 @@ -297,14 +296,14 @@ i32.add global.set $__stack_pointer ) - (func $>::from (;10;) (type 8) (param i32) (result f32) + (func $>::from (;10;) (type 7) (param i32) (result f32) local.get 0 f32.reinterpret_i32 ) - (func $intrinsics::felt::from_u32 (;11;) (type 8) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;11;) (type 7) (param i32) (result f32) unreachable ) - (func $intrinsics::felt::assert_eq (;12;) (type 9) (param f32 f32) + (func $intrinsics::felt::assert_eq (;12;) (type 8) (param f32 f32) unreachable ) (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 2) (param i32 i32 i32) @@ -339,7 +338,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;14;) (type 10) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;14;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -480,7 +479,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;16;) (type 6) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;16;) (type 10) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -507,7 +506,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;17;) (type 6) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;17;) (type 10) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -615,5 +614,5 @@ end local.get 2 ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/active_note.rs\00\00\00\00\00\00\10\000\00\00\00\1f\00\00\00!\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00") ) diff --git a/tests/integration/expected/adv_load_preimage.hir b/tests/integration/expected/adv_load_preimage.hir index a29bf56c4..b8867153b 100644 --- a/tests/integration/expected/adv_load_preimage.hir +++ b/tests/integration/expected/adv_load_preimage.hir @@ -66,7 +66,7 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v153 #[code = 250]; v154 = hir.int_to_ptr v151 : ptr; v155 = hir.load v154 : i32; - v156 = arith.constant 1048620 : i32; + v156 = arith.constant 1048588 : i32; hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v46, v155, v156) v516 = arith.constant 0 : u32; scf.yield v516; @@ -213,14 +213,14 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @__rustc::__rust_alloc(v157: i32, v158: i32) -> i32 { ^block12(v157: i32, v158: i32): - v160 = arith.constant 1048636 : i32; + v160 = arith.constant 1048604 : i32; v161 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v160, v158, v157) : i32 builtin.ret v161; }; private builtin.function @__rustc::__rust_alloc_zeroed(v162: i32, v163: i32) -> i32 { ^block14(v162: i32, v163: i32): - v165 = arith.constant 1048636 : i32; + v165 = arith.constant 1048604 : i32; v166 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v165, v163, v162) : i32 v566 = arith.constant 0 : i32; v167 = arith.constant 0 : i32; @@ -745,6 +745,6 @@ builtin.component root_ns:root@1.0.0 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x000000210000009700000028001000000000000073722e6d656d2f62696c6474732f6372732f312e372e302d7379732d62696c6474732d6e6564696d; + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/adv_load_preimage.masm b/tests/integration/expected/adv_load_preimage.masm index aaa68e1e5..a90503491 100644 --- a/tests/integration/expected/adv_load_preimage.masm +++ b/tests/integration/expected/adv_load_preimage.masm @@ -5,24 +5,24 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[9819768856120359178,13486156918318591171,2261048595876917691,16294779277798976606] + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] adv.push_mapval push.262144 - push.4 + push.2 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 end # mod root_ns:root@1.0.0::adv_load_preimage @callconv("C") pub proc entrypoint(i32, felt, felt, felt, felt) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -32,7 +32,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -198,7 +198,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.1048620 + push.1048588 swap.2 trace.240 nop @@ -450,7 +450,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) push.16 movup.2 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -478,7 +478,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048636 + push.1048604 movup.2 swap.1 trace.240 @@ -490,7 +490,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048636 + push.1048604 dup.1 swap.2 swap.3 @@ -819,7 +819,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -829,7 +829,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1214,7 +1214,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1230,7 +1230,7 @@ proc ::allocate( i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1240,7 +1240,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1333,7 +1333,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/adv_load_preimage.wat b/tests/integration/expected/adv_load_preimage.wat index 5fc4581f5..399021d87 100644 --- a/tests/integration/expected/adv_load_preimage.wat +++ b/tests/integration/expected/adv_load_preimage.wat @@ -127,20 +127,20 @@ local.get 9 local.get 5 i32.load offset=12 - i32.const 1048620 + i32.const 1048588 call $alloc::raw_vec::handle_error end unreachable ) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) - i32.const 1048636 + i32.const 1048604 local.get 1 local.get 0 call $::alloc ) (func $__rustc::__rust_alloc_zeroed (;2;) (type 1) (param i32 i32) (result i32) block ;; label = @1 - i32.const 1048636 + i32.const 1048604 local.get 1 local.get 0 call $::alloc @@ -432,5 +432,5 @@ i32.gt_u select ) - (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.7.1/src/stdlib/mem.rs\00\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index 28864324a..02c97171e 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -11,119 +11,124 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret ; }; - private builtin.function @core::slice::index::slice_end_index_len_fail(v5: i32, v6: i32, v7: i32) { - ^block10(v5: i32, v6: i32, v7: i32): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v5, v6, v7) + private builtin.function @core::slice::index::slice_end_index_len_fail(v5: i32, v6: i32) { + ^block10(v5: i32, v6: i32): + v7 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v8 = hir.bitcast v7 : ptr; + v9 = hir.load v8 : i32; + v10 = arith.constant 1048600 : i32; + v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v5, v6, v11) ub.unreachable ; }; - private builtin.function @ as core::ops::index::Index>::index(v8: i32, v9: i32, v10: i32, v11: i32, v12: i32) { - ^block12(v8: i32, v9: i32, v10: i32, v11: i32, v12: i32): - v15 = arith.constant 8 : u32; - v14 = hir.bitcast v9 : 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; - v13 = arith.constant 0 : i32; - v22 = hir.bitcast v20 : u32; - v21 = hir.bitcast v11 : u32; - v23 = arith.lte v21, v22 : i1; - v24 = arith.zext v23 : u32; - v25 = hir.bitcast v24 : i32; - v27 = arith.neq v25, v13 : i1; - cf.cond_br v27 ^block14, ^block15; + private builtin.function @ as core::ops::index::Index>::index(v12: i32, v13: i32, v14: i32, v15: i32) { + ^block12(v12: i32, v13: i32, v14: i32, v15: i32): + v18 = arith.constant 8 : u32; + v17 = hir.bitcast v13 : 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; + v23 = hir.load v22 : i32; + v16 = arith.constant 0 : i32; + v25 = hir.bitcast v23 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.lte v24, v25 : i1; + v27 = arith.zext v26 : u32; + v28 = hir.bitcast v27 : i32; + v30 = arith.neq v28, v16 : i1; + cf.cond_br v30 ^block14, ^block15; ^block14: - v915 = arith.constant 4 : u32; - v29 = hir.bitcast v8 : u32; - v31 = arith.add v29, v915 : u32 #[overflow = checked]; - v914 = arith.constant 4 : u32; - v33 = arith.mod v31, v914 : u32; - hir.assertz v33 #[code = 250]; - v28 = arith.sub v11, v10 : i32 #[overflow = wrapping]; - v34 = hir.int_to_ptr v31 : ptr; - hir.store v34, v28; - v913 = arith.constant 4 : u32; - v35 = hir.bitcast v9 : u32; - v37 = arith.add v35, v913 : u32 #[overflow = checked]; - v912 = arith.constant 4 : u32; - v39 = arith.mod v37, v912 : u32; - hir.assertz v39 #[code = 250]; - v40 = hir.int_to_ptr v37 : ptr; - v41 = hir.load v40 : i32; - v46 = hir.bitcast v8 : u32; - v911 = arith.constant 4 : u32; - v48 = arith.mod v46, v911 : u32; - hir.assertz v48 #[code = 250]; - v909 = arith.constant 2 : u32; - v44 = arith.shl v10, v909 : i32; - v45 = arith.add v41, v44 : i32 #[overflow = wrapping]; - v49 = hir.int_to_ptr v46 : ptr; - hir.store v49, v45; + v908 = arith.constant 4 : u32; + v32 = hir.bitcast v12 : u32; + v34 = arith.add v32, v908 : u32 #[overflow = checked]; + v907 = arith.constant 4 : u32; + v36 = arith.mod v34, v907 : u32; + hir.assertz v36 #[code = 250]; + v31 = arith.sub v15, v14 : i32 #[overflow = wrapping]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v31; + v906 = arith.constant 4 : u32; + v38 = hir.bitcast v13 : u32; + v40 = arith.add v38, v906 : u32 #[overflow = checked]; + v905 = arith.constant 4 : u32; + v42 = arith.mod v40, v905 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : i32; + v49 = hir.bitcast v12 : u32; + v904 = arith.constant 4 : u32; + v51 = arith.mod v49, v904 : u32; + hir.assertz v51 #[code = 250]; + v902 = arith.constant 2 : u32; + v47 = arith.shl v14, v902 : i32; + v48 = arith.add v44, v47 : i32 #[overflow = wrapping]; + v52 = hir.int_to_ptr v49 : ptr; + hir.store v52, v48; builtin.ret ; ^block15: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_end_index_len_fail(v11, v20, v12) + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_end_index_len_fail(v15, v23) ub.unreachable ; }; - private builtin.function @__rustc::__rust_alloc(v50: i32, v51: i32) -> i32 { - ^block16(v50: i32, v51: i32): - v53 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v54 = hir.bitcast v53 : ptr; - v55 = hir.load v54 : i32; - v56 = arith.constant 1048688 : i32; - v57 = arith.add v55, v56 : i32 #[overflow = wrapping]; - v58 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v57, v51, v50) : i32 - builtin.ret v58; + private builtin.function @__rustc::__rust_alloc(v53: i32, v54: i32) -> i32 { + ^block16(v53: i32, v54: i32): + v56 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v57 = hir.bitcast v56 : ptr; + v58 = hir.load v57 : i32; + v59 = arith.constant 1048616 : i32; + v60 = arith.add v58, v59 : i32 #[overflow = wrapping]; + v61 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v60, v54, v53) : i32 + builtin.ret v61; }; - private builtin.function @__rustc::__rust_dealloc(v59: i32, v60: i32, v61: i32) { - ^block18(v59: i32, v60: i32, v61: i32): + private builtin.function @__rustc::__rust_dealloc(v62: i32, v63: i32, v64: i32) { + ^block18(v62: i32, v63: i32, v64: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v62: i32, v63: i32) -> i32 { - ^block20(v62: i32, v63: i32): - v65 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v66 = hir.bitcast v65 : ptr; - v67 = hir.load v66 : i32; - v68 = arith.constant 1048688 : i32; - v69 = arith.add v67, v68 : i32 #[overflow = wrapping]; - v70 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v69, v63, v62) : i32 - v924 = arith.constant 0 : i32; - v71 = arith.constant 0 : i32; - v72 = arith.eq v70, v71 : i1; - v73 = arith.zext v72 : u32; - v74 = hir.bitcast v73 : i32; - v76 = arith.neq v74, v924 : i1; - scf.if v76{ + private builtin.function @__rustc::__rust_alloc_zeroed(v65: i32, v66: i32) -> i32 { + ^block20(v65: i32, v66: i32): + v68 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 1048616 : i32; + v72 = arith.add v70, v71 : i32 #[overflow = wrapping]; + v73 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v72, v66, v65) : i32 + v917 = arith.constant 0 : i32; + v74 = arith.constant 0 : i32; + v75 = arith.eq v73, v74 : i1; + v76 = arith.zext v75 : u32; + v77 = hir.bitcast v76 : i32; + v79 = arith.neq v77, v917 : i1; + scf.if v79{ ^block22: scf.yield ; } else { ^block23: - v922 = arith.constant 0 : i32; - v923 = arith.constant 0 : i32; - v78 = arith.eq v62, v923 : i1; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v922 : i1; - scf.if v82{ + v915 = arith.constant 0 : i32; + v916 = arith.constant 0 : i32; + v81 = arith.eq v65, v916 : i1; + v82 = arith.zext v81 : u32; + v83 = hir.bitcast v82 : i32; + v85 = arith.neq v83, v915 : i1; + scf.if v85{ ^block122: scf.yield ; } else { ^block24: - v916 = arith.constant 0 : u8; - v85 = hir.bitcast v62 : u32; - v86 = hir.bitcast v70 : u32; - v87 = hir.int_to_ptr v86 : ptr; - hir.mem_set v87, v85, v916; + v909 = arith.constant 0 : u8; + v88 = hir.bitcast v65 : u32; + v89 = hir.bitcast v73 : u32; + v90 = hir.int_to_ptr v89 : ptr; + hir.mem_set v90, v88, v909; scf.yield ; }; scf.yield ; }; - builtin.ret v70; + builtin.ret v73; }; private builtin.function @basic_wallet_tx_script::bindings::__link_custom_section_describing_imports() { @@ -131,370 +136,360 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden:base/transaction-script@1.0.0#run(v89: felt, v90: felt, v91: felt, v92: felt) { - ^block27(v89: felt, v90: felt, v91: felt, v92: felt): - v97 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 80 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v102 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v103 = hir.bitcast v102 : ptr; - hir.store v103, v101; + private builtin.function @miden:base/transaction-script@1.0.0#run(v92: felt, v93: felt, v94: felt, v95: felt) { + ^block27(v92: felt, v93: felt, v94: felt, v95: felt): + v100 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v101 = hir.bitcast v100 : ptr; + v102 = hir.load v101 : i32; + v103 = arith.constant 80 : i32; + v104 = arith.sub v102, v103 : i32 #[overflow = wrapping]; + v105 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v106 = hir.bitcast v105 : ptr; + hir.store v106, v104; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/wit_bindgen::rt::run_ctors_once() - v104 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v92, v91, v90, v89) : felt - v105 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v104) : i64 - v107 = arith.constant 3 : i32; - v106 = arith.trunc v105 : i32; - v108 = arith.band v106, v107 : i32; - v109 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v108) : felt - v93 = arith.constant 0 : i32; - v111 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v93) : felt - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::assert_eq(v109, v111) - v114 = arith.constant 2 : i64; - v116 = hir.cast v114 : u32; - v115 = hir.bitcast v105 : u64; - v117 = arith.shr v115, v116 : u64; - v118 = hir.bitcast v117 : i64; - v119 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u64_unchecked(v118) : felt - v120 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v119) : i64 - v926 = arith.constant 2 : u32; - v121 = arith.trunc v120 : i32; - v124 = arith.shl v121, v926 : i32; - v126 = arith.constant 4 : i32; - v1002 = arith.constant 0 : i32; - v112 = arith.constant 64 : i32; - v113 = arith.add v101, v112 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::try_allocate_in(v113, v124, v1002, v126, v126) - v129 = arith.constant 68 : u32; - v128 = hir.bitcast v101 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v131 = arith.constant 4 : u32; - v132 = arith.mod v130, v131 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - v134 = hir.load v133 : i32; - v136 = arith.constant 64 : u32; - v135 = hir.bitcast v101 : u32; - v137 = arith.add v135, v136 : u32 #[overflow = checked]; - v1001 = arith.constant 4 : u32; - v139 = arith.mod v137, v1001 : u32; - hir.assertz v139 #[code = 250]; - v140 = hir.int_to_ptr v137 : ptr; - v141 = hir.load v140 : i32; - v1000 = arith.constant 0 : i32; - v142 = arith.constant 1 : i32; - v143 = arith.eq v141, v142 : i1; - v144 = arith.zext v143 : u32; - v145 = hir.bitcast v144 : i32; - v147 = arith.neq v145, v1000 : i1; - v931 = scf.if v147 : u32 { + v107 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v95, v94, v93, v92) : felt + v108 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v107) : i64 + v110 = arith.constant 3 : i32; + v109 = arith.trunc v108 : i32; + v111 = arith.band v109, v110 : i32; + v112 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v111) : felt + v96 = arith.constant 0 : i32; + v114 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v96) : felt + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::assert_eq(v112, v114) + v117 = arith.constant 2 : i64; + v119 = hir.cast v117 : u32; + v118 = hir.bitcast v108 : u64; + v120 = arith.shr v118, v119 : u64; + v121 = hir.bitcast v120 : i64; + v122 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u64_unchecked(v121) : felt + v123 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v122) : i64 + v919 = arith.constant 2 : u32; + v124 = arith.trunc v123 : i32; + v127 = arith.shl v124, v919 : i32; + v129 = arith.constant 4 : i32; + v995 = arith.constant 0 : i32; + v115 = arith.constant 64 : i32; + v116 = arith.add v104, v115 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::try_allocate_in(v116, v127, v995, v129, v129) + v132 = arith.constant 68 : u32; + v131 = hir.bitcast v104 : 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 : i32; + v139 = arith.constant 64 : u32; + v138 = hir.bitcast v104 : u32; + v140 = arith.add v138, v139 : u32 #[overflow = checked]; + v994 = arith.constant 4 : u32; + v142 = arith.mod v140, v994 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + v144 = hir.load v143 : i32; + v993 = arith.constant 0 : i32; + v145 = arith.constant 1 : i32; + v146 = arith.eq v144, v145 : i1; + v147 = arith.zext v146 : u32; + v148 = hir.bitcast v147 : i32; + v150 = arith.neq v148, v993 : i1; + v924 = scf.if v150 : u32 { ^block30: - v368 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v369 = hir.bitcast v368 : ptr; + v361 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v362 = hir.bitcast v361 : ptr; + v363 = hir.load v362 : i32; + v365 = arith.constant 72 : u32; + v364 = hir.bitcast v104 : u32; + v366 = arith.add v364, v365 : u32 #[overflow = checked]; + v992 = arith.constant 4 : u32; + v368 = arith.mod v366, v992 : u32; + hir.assertz v368 #[code = 250]; + v369 = hir.int_to_ptr v366 : ptr; v370 = hir.load v369 : i32; - v372 = arith.constant 72 : u32; - v371 = hir.bitcast v101 : u32; - v373 = arith.add v371, v372 : u32 #[overflow = checked]; - v999 = arith.constant 4 : u32; - v375 = arith.mod v373, v999 : u32; - hir.assertz v375 #[code = 250]; - v376 = hir.int_to_ptr v373 : ptr; - v377 = hir.load v376 : i32; - v378 = arith.constant 1048640 : i32; - v379 = arith.add v370, v378 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v134, v377, v379) - v927 = arith.constant 0 : u32; - scf.yield v927; + v371 = arith.constant 1048600 : i32; + v372 = arith.add v363, v371 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v137, v370, v372) + v920 = arith.constant 0 : u32; + scf.yield v920; } else { ^block31: - v998 = arith.constant 72 : u32; - v148 = hir.bitcast v101 : u32; - v150 = arith.add v148, v998 : u32 #[overflow = checked]; - v997 = arith.constant 4 : u32; - v152 = arith.mod v150, v997 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - v154 = hir.load v153 : i32; - v996 = arith.constant 2 : u32; - v156 = hir.bitcast v154 : u32; - v158 = arith.shr v156, v996 : u32; - v159 = hir.bitcast v158 : i32; - v160 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/std::mem::pipe_preimage_to_memory(v119, v159, v92, v91, v90, v89) : i32 - v162 = arith.constant 28 : u32; - v161 = hir.bitcast v101 : u32; - v163 = arith.add v161, v162 : u32 #[overflow = checked]; - v995 = arith.constant 4 : u32; - v165 = arith.mod v163, v995 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v124; - v168 = arith.constant 24 : u32; - v167 = hir.bitcast v101 : u32; - v169 = arith.add v167, v168 : u32 #[overflow = checked]; - v994 = arith.constant 4 : u32; - v171 = arith.mod v169, v994 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v154; - v174 = arith.constant 20 : u32; - v173 = hir.bitcast v101 : u32; - v175 = arith.add v173, v174 : u32 #[overflow = checked]; - v993 = arith.constant 4 : u32; - v177 = arith.mod v175, v993 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - hir.store v178, v134; - v991 = arith.constant 0 : i32; - v992 = arith.constant 0 : i32; - v180 = arith.eq v124, v992 : i1; - v181 = arith.zext v180 : u32; - v182 = hir.bitcast v181 : i32; - v184 = arith.neq v182, v991 : i1; - v933 = scf.if v184 : u32 { + v991 = arith.constant 72 : u32; + v151 = hir.bitcast v104 : u32; + v153 = arith.add v151, v991 : u32 #[overflow = checked]; + v990 = arith.constant 4 : u32; + v155 = arith.mod v153, v990 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : i32; + v989 = arith.constant 2 : u32; + v159 = hir.bitcast v157 : u32; + v161 = arith.shr v159, v989 : u32; + v162 = hir.bitcast v161 : i32; + v163 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/std::mem::pipe_preimage_to_memory(v122, v162, v95, v94, v93, v92) : i32 + v165 = arith.constant 28 : u32; + v164 = hir.bitcast v104 : u32; + v166 = arith.add v164, v165 : u32 #[overflow = checked]; + v988 = arith.constant 4 : u32; + v168 = arith.mod v166, v988 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + hir.store v169, v127; + v171 = arith.constant 24 : u32; + v170 = hir.bitcast v104 : u32; + v172 = arith.add v170, v171 : u32 #[overflow = checked]; + v987 = arith.constant 4 : u32; + v174 = arith.mod v172, v987 : u32; + hir.assertz v174 #[code = 250]; + v175 = hir.int_to_ptr v172 : ptr; + hir.store v175, v157; + v177 = arith.constant 20 : u32; + v176 = hir.bitcast v104 : u32; + v178 = arith.add v176, v177 : u32 #[overflow = checked]; + v986 = arith.constant 4 : u32; + v180 = arith.mod v178, v986 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v137; + v984 = arith.constant 0 : i32; + v985 = arith.constant 0 : i32; + v183 = arith.eq v127, v985 : i1; + v184 = arith.zext v183 : u32; + v185 = hir.bitcast v184 : i32; + v187 = arith.neq v185, v984 : i1; + v926 = scf.if v187 : u32 { ^block127: - v990 = arith.constant 0 : u32; - scf.yield v990; + v983 = arith.constant 0 : u32; + scf.yield v983; } else { ^block32: - v185 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v186 = hir.bitcast v185 : ptr; - v187 = hir.load v186 : i32; v189 = arith.constant 12 : u32; - v188 = hir.bitcast v154 : u32; + v188 = hir.bitcast v157 : u32; v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v989 = arith.constant 4 : u32; - v192 = arith.mod v190, v989 : u32; + v982 = arith.constant 4 : u32; + v192 = arith.mod v190, v982 : u32; hir.assertz v192 #[code = 250]; v193 = hir.int_to_ptr v190 : ptr; v194 = hir.load v193 : felt; v196 = arith.constant 8 : u32; - v195 = hir.bitcast v154 : u32; + v195 = hir.bitcast v157 : u32; v197 = arith.add v195, v196 : u32 #[overflow = checked]; - v988 = arith.constant 4 : u32; - v199 = arith.mod v197, v988 : u32; + v981 = arith.constant 4 : u32; + v199 = arith.mod v197, v981 : u32; hir.assertz v199 #[code = 250]; v200 = hir.int_to_ptr v197 : ptr; v201 = hir.load v200 : felt; - v987 = arith.constant 4 : u32; - v202 = hir.bitcast v154 : u32; - v204 = arith.add v202, v987 : u32 #[overflow = checked]; - v986 = arith.constant 4 : u32; - v206 = arith.mod v204, v986 : u32; + v980 = arith.constant 4 : u32; + v202 = hir.bitcast v157 : u32; + v204 = arith.add v202, v980 : u32 #[overflow = checked]; + v979 = arith.constant 4 : u32; + v206 = arith.mod v204, v979 : u32; hir.assertz v206 #[code = 250]; v207 = hir.int_to_ptr v204 : ptr; v208 = hir.load v207 : felt; - v209 = hir.bitcast v154 : u32; - v985 = arith.constant 4 : u32; - v211 = arith.mod v209, v985 : u32; + v209 = hir.bitcast v157 : u32; + v978 = arith.constant 4 : u32; + v211 = arith.mod v209, v978 : u32; hir.assertz v211 #[code = 250]; v212 = hir.int_to_ptr v209 : ptr; v213 = hir.load v212 : felt; - v220 = arith.constant 1048656 : i32; - v221 = arith.add v187, v220 : i32 #[overflow = wrapping]; - v983 = arith.constant 8 : i32; - v984 = arith.constant 4 : i32; + v976 = arith.constant 8 : i32; + v977 = arith.constant 4 : i32; v216 = arith.constant 20 : i32; - v217 = arith.add v101, v216 : i32 #[overflow = wrapping]; + v217 = arith.add v104, v216 : i32 #[overflow = wrapping]; v214 = arith.constant 8 : i32; - v215 = arith.add v101, v214 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v215, v217, v984, v983, v221) - v982 = arith.constant 12 : u32; - v222 = hir.bitcast v101 : u32; - v224 = arith.add v222, v982 : u32 #[overflow = checked]; - v981 = arith.constant 4 : u32; - v226 = arith.mod v224, v981 : u32; - hir.assertz v226 #[code = 250]; - v227 = hir.int_to_ptr v224 : ptr; - v228 = hir.load v227 : i32; - v979 = arith.constant 0 : i32; - v980 = arith.constant 4 : i32; - v230 = arith.neq v228, v980 : i1; - v231 = arith.zext v230 : u32; - v232 = hir.bitcast v231 : i32; - v234 = arith.neq v232, v979 : i1; - v935 = scf.if v234 : u32 { + v215 = arith.add v104, v214 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v215, v217, v977, v976) + v975 = arith.constant 12 : u32; + v220 = hir.bitcast v104 : u32; + v222 = arith.add v220, v975 : u32 #[overflow = checked]; + v974 = arith.constant 4 : u32; + v224 = arith.mod v222, v974 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : i32; + v972 = arith.constant 0 : i32; + v973 = arith.constant 4 : i32; + v228 = arith.neq v226, v973 : i1; + v229 = arith.zext v228 : u32; + v230 = hir.bitcast v229 : i32; + v232 = arith.neq v230, v972 : i1; + v928 = scf.if v232 : u32 { ^block126: - v978 = arith.constant 0 : u32; - scf.yield v978; + v971 = arith.constant 0 : u32; + scf.yield v971; } else { ^block33: - v977 = arith.constant 8 : u32; - v235 = hir.bitcast v101 : u32; - v237 = arith.add v235, v977 : u32 #[overflow = checked]; - v976 = arith.constant 4 : u32; - v239 = arith.mod v237, v976 : u32; - hir.assertz v239 #[code = 250]; - v240 = hir.int_to_ptr v237 : ptr; - v241 = hir.load v240 : i32; - v242 = hir.bitcast v241 : u32; - v975 = arith.constant 4 : u32; - v244 = arith.mod v242, v975 : u32; - hir.assertz v244 #[code = 250]; - v245 = hir.int_to_ptr v242 : ptr; - v246 = hir.load v245 : i64; - v974 = arith.constant 8 : i32; - v252 = arith.add v241, v974 : i32 #[overflow = wrapping]; - v253 = hir.bitcast v252 : u32; - v973 = arith.constant 4 : u32; - v255 = arith.mod v253, v973 : u32; - hir.assertz v255 #[code = 250]; - v256 = hir.int_to_ptr v253 : ptr; - v257 = hir.load v256 : i64; - v972 = arith.constant 8 : i32; - v247 = arith.constant 32 : i32; - v248 = arith.add v101, v247 : i32 #[overflow = wrapping]; - v250 = arith.add v248, v972 : i32 #[overflow = wrapping]; - v258 = hir.bitcast v250 : u32; - v971 = arith.constant 8 : u32; - v260 = arith.mod v258, v971 : u32; - hir.assertz v260 #[code = 250]; - v261 = hir.int_to_ptr v258 : ptr; - hir.store v261, v257; - v263 = arith.constant 32 : u32; - v262 = hir.bitcast v101 : u32; - v264 = arith.add v262, v263 : u32 #[overflow = checked]; v970 = arith.constant 8 : u32; - v266 = arith.mod v264, v970 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - hir.store v267, v246; - v268 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v269 = hir.bitcast v268 : ptr; - v270 = hir.load v269 : i32; - v968 = arith.constant 32 : i32; - v274 = arith.add v101, v968 : i32 #[overflow = wrapping]; - v969 = arith.constant 64 : i32; - v272 = arith.add v101, v969 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v272, v274) - v967 = arith.constant 64 : i32; - v276 = arith.add v101, v967 : i32 #[overflow = wrapping]; - v277 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v213, v208, v201, v194, v276) : felt - v282 = arith.constant 1048672 : i32; - v283 = arith.add v270, v282 : i32 #[overflow = wrapping]; - v281 = arith.constant 12 : i32; + v233 = hir.bitcast v104 : u32; + v235 = arith.add v233, v970 : u32 #[overflow = checked]; + v969 = arith.constant 4 : u32; + v237 = arith.mod v235, v969 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + v239 = hir.load v238 : i32; + v240 = hir.bitcast v239 : u32; + v968 = arith.constant 4 : u32; + v242 = arith.mod v240, v968 : u32; + hir.assertz v242 #[code = 250]; + v243 = hir.int_to_ptr v240 : ptr; + v244 = hir.load v243 : i64; + v967 = arith.constant 8 : i32; + v250 = arith.add v239, v967 : i32 #[overflow = wrapping]; + v251 = hir.bitcast v250 : u32; + v966 = arith.constant 4 : u32; + v253 = arith.mod v251, v966 : u32; + hir.assertz v253 #[code = 250]; + v254 = hir.int_to_ptr v251 : ptr; + v255 = hir.load v254 : i64; v965 = arith.constant 8 : i32; - v966 = arith.constant 20 : i32; - v279 = arith.add v101, v966 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v101, v279, v965, v281, v283) - v964 = arith.constant 4 : u32; - v284 = hir.bitcast v101 : u32; - v286 = arith.add v284, v964 : u32 #[overflow = checked]; - v963 = arith.constant 4 : u32; - v288 = arith.mod v286, v963 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - v290 = hir.load v289 : i32; - v961 = arith.constant 0 : i32; - v962 = arith.constant 4 : i32; - v292 = arith.neq v290, v962 : i1; - v293 = arith.zext v292 : u32; - v294 = hir.bitcast v293 : i32; - v296 = arith.neq v294, v961 : i1; - scf.if v296{ + v245 = arith.constant 32 : i32; + v246 = arith.add v104, v245 : i32 #[overflow = wrapping]; + v248 = arith.add v246, v965 : i32 #[overflow = wrapping]; + v256 = hir.bitcast v248 : u32; + v964 = arith.constant 8 : u32; + v258 = arith.mod v256, v964 : u32; + hir.assertz v258 #[code = 250]; + v259 = hir.int_to_ptr v256 : ptr; + hir.store v259, v255; + v261 = arith.constant 32 : u32; + v260 = hir.bitcast v104 : u32; + v262 = arith.add v260, v261 : u32 #[overflow = checked]; + v963 = arith.constant 8 : u32; + v264 = arith.mod v262, v963 : u32; + hir.assertz v264 #[code = 250]; + v265 = hir.int_to_ptr v262 : ptr; + hir.store v265, v244; + v961 = arith.constant 32 : i32; + v269 = arith.add v104, v961 : i32 #[overflow = wrapping]; + v962 = arith.constant 64 : i32; + v267 = arith.add v104, v962 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v267, v269) + v960 = arith.constant 64 : i32; + v271 = arith.add v104, v960 : i32 #[overflow = wrapping]; + v272 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v213, v208, v201, v194, v271) : felt + v276 = arith.constant 12 : i32; + v958 = arith.constant 8 : i32; + v959 = arith.constant 20 : i32; + v274 = arith.add v104, v959 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v104, v274, v958, v276) + v957 = arith.constant 4 : u32; + v277 = hir.bitcast v104 : u32; + v279 = arith.add v277, v957 : u32 #[overflow = checked]; + v956 = arith.constant 4 : u32; + v281 = arith.mod v279, v956 : u32; + hir.assertz v281 #[code = 250]; + v282 = hir.int_to_ptr v279 : ptr; + v283 = hir.load v282 : i32; + v954 = arith.constant 0 : i32; + v955 = arith.constant 4 : i32; + v285 = arith.neq v283, v955 : i1; + v286 = arith.zext v285 : u32; + v287 = hir.bitcast v286 : i32; + v289 = arith.neq v287, v954 : i1; + scf.if v289{ ^block125: scf.yield ; } else { ^block34: - v297 = hir.bitcast v101 : u32; - v960 = arith.constant 4 : u32; - v299 = arith.mod v297, v960 : u32; - hir.assertz v299 #[code = 250]; - v300 = hir.int_to_ptr v297 : ptr; - v301 = hir.load v300 : i32; - v302 = hir.bitcast v301 : u32; - v959 = arith.constant 4 : u32; - v304 = arith.mod v302, v959 : u32; - hir.assertz v304 #[code = 250]; - v305 = hir.int_to_ptr v302 : ptr; - v306 = hir.load v305 : i64; - v958 = arith.constant 8 : i32; - v312 = arith.add v301, v958 : i32 #[overflow = wrapping]; - v313 = hir.bitcast v312 : u32; - v957 = arith.constant 4 : u32; - v315 = arith.mod v313, v957 : u32; - hir.assertz v315 #[code = 250]; - v316 = hir.int_to_ptr v313 : ptr; - v317 = hir.load v316 : i64; - v956 = arith.constant 8 : i32; - v307 = arith.constant 48 : i32; - v308 = arith.add v101, v307 : i32 #[overflow = wrapping]; - v310 = arith.add v308, v956 : i32 #[overflow = wrapping]; - v318 = hir.bitcast v310 : u32; - v955 = arith.constant 8 : u32; - v320 = arith.mod v318, v955 : u32; - hir.assertz v320 #[code = 250]; - v321 = hir.int_to_ptr v318 : ptr; - hir.store v321, v317; - v323 = arith.constant 48 : u32; - v322 = hir.bitcast v101 : u32; - v324 = arith.add v322, v323 : u32 #[overflow = checked]; - v954 = arith.constant 8 : u32; - v326 = arith.mod v324, v954 : u32; - hir.assertz v326 #[code = 250]; - v327 = hir.int_to_ptr v324 : ptr; - hir.store v327, v306; - v952 = arith.constant 48 : i32; - v331 = arith.add v101, v952 : i32 #[overflow = wrapping]; - v953 = arith.constant 64 : i32; - v329 = arith.add v101, v953 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v329, v331) - v951 = arith.constant 64 : u32; - v332 = hir.bitcast v101 : u32; - v334 = arith.add v332, v951 : u32 #[overflow = checked]; + v290 = hir.bitcast v104 : u32; + v953 = arith.constant 4 : u32; + v292 = arith.mod v290, v953 : u32; + hir.assertz v292 #[code = 250]; + v293 = hir.int_to_ptr v290 : ptr; + v294 = hir.load v293 : i32; + v295 = hir.bitcast v294 : u32; + v952 = arith.constant 4 : u32; + v297 = arith.mod v295, v952 : u32; + hir.assertz v297 #[code = 250]; + v298 = hir.int_to_ptr v295 : ptr; + v299 = hir.load v298 : i64; + v951 = arith.constant 8 : i32; + v305 = arith.add v294, v951 : i32 #[overflow = wrapping]; + v306 = hir.bitcast v305 : u32; v950 = arith.constant 4 : u32; - v336 = arith.mod v334, v950 : u32; + v308 = arith.mod v306, v950 : u32; + hir.assertz v308 #[code = 250]; + v309 = hir.int_to_ptr v306 : ptr; + v310 = hir.load v309 : i64; + v949 = arith.constant 8 : i32; + v300 = arith.constant 48 : i32; + v301 = arith.add v104, v300 : i32 #[overflow = wrapping]; + v303 = arith.add v301, v949 : i32 #[overflow = wrapping]; + v311 = hir.bitcast v303 : u32; + v948 = arith.constant 8 : u32; + v313 = arith.mod v311, v948 : u32; + hir.assertz v313 #[code = 250]; + v314 = hir.int_to_ptr v311 : ptr; + hir.store v314, v310; + v316 = arith.constant 48 : u32; + v315 = hir.bitcast v104 : u32; + v317 = arith.add v315, v316 : u32 #[overflow = checked]; + v947 = arith.constant 8 : u32; + v319 = arith.mod v317, v947 : u32; + hir.assertz v319 #[code = 250]; + v320 = hir.int_to_ptr v317 : ptr; + hir.store v320, v299; + v945 = arith.constant 48 : i32; + v324 = arith.add v104, v945 : i32 #[overflow = wrapping]; + v946 = arith.constant 64 : i32; + v322 = arith.add v104, v946 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v322, v324) + v944 = arith.constant 64 : u32; + v325 = hir.bitcast v104 : u32; + v327 = arith.add v325, v944 : u32 #[overflow = checked]; + v943 = arith.constant 4 : u32; + v329 = arith.mod v327, v943 : u32; + hir.assertz v329 #[code = 250]; + v330 = hir.int_to_ptr v327 : ptr; + v331 = hir.load v330 : felt; + v942 = arith.constant 68 : u32; + v332 = hir.bitcast v104 : u32; + v334 = arith.add v332, v942 : u32 #[overflow = checked]; + v941 = arith.constant 4 : u32; + v336 = arith.mod v334, v941 : u32; hir.assertz v336 #[code = 250]; v337 = hir.int_to_ptr v334 : ptr; v338 = hir.load v337 : felt; - v949 = arith.constant 68 : u32; - v339 = hir.bitcast v101 : u32; - v341 = arith.add v339, v949 : u32 #[overflow = checked]; - v948 = arith.constant 4 : u32; - v343 = arith.mod v341, v948 : u32; + v940 = arith.constant 72 : u32; + v339 = hir.bitcast v104 : u32; + v341 = arith.add v339, v940 : u32 #[overflow = checked]; + v939 = arith.constant 4 : u32; + v343 = arith.mod v341, v939 : u32; hir.assertz v343 #[code = 250]; v344 = hir.int_to_ptr v341 : ptr; v345 = hir.load v344 : felt; - v947 = arith.constant 72 : u32; - v346 = hir.bitcast v101 : u32; - v348 = arith.add v346, v947 : u32 #[overflow = checked]; - v946 = arith.constant 4 : u32; - v350 = arith.mod v348, v946 : u32; + v347 = arith.constant 76 : u32; + v346 = hir.bitcast v104 : u32; + v348 = arith.add v346, v347 : u32 #[overflow = checked]; + v938 = arith.constant 4 : u32; + v350 = arith.mod v348, v938 : u32; hir.assertz v350 #[code = 250]; v351 = hir.int_to_ptr v348 : ptr; v352 = hir.load v351 : felt; - v354 = arith.constant 76 : u32; - v353 = hir.bitcast v101 : u32; - v355 = arith.add v353, v354 : u32 #[overflow = checked]; - v945 = arith.constant 4 : u32; - v357 = arith.mod v355, v945 : u32; - hir.assertz v357 #[code = 250]; - v358 = hir.int_to_ptr v355 : ptr; - v359 = hir.load v358 : 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(v338, v345, v352, v359, v277) - v943 = arith.constant 4 : i32; - v944 = arith.constant 20 : i32; - v361 = arith.add v101, v944 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::deallocate(v361, v943, v943) - v942 = arith.constant 80 : i32; - v365 = arith.add v101, v942 : i32 #[overflow = wrapping]; - v366 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v367 = hir.bitcast v366 : ptr; - hir.store v367, v365; + 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(v331, v338, v345, v352, v272) + v936 = arith.constant 4 : i32; + v937 = arith.constant 20 : i32; + v354 = arith.add v104, v937 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::deallocate(v354, v936, v936) + v935 = arith.constant 80 : i32; + v358 = arith.add v104, v935 : i32 #[overflow = wrapping]; + v359 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v360 = hir.bitcast v359 : ptr; + hir.store v360, v358; scf.yield ; }; - v929 = arith.constant 1 : u32; - v941 = arith.constant 0 : u32; - v939 = cf.select v296, v941, v929 : u32; - scf.yield v939; + v922 = arith.constant 1 : u32; + v934 = arith.constant 0 : u32; + v932 = cf.select v289, v934, v922 : u32; + scf.yield v932; }; - scf.yield v935; + scf.yield v928; }; - scf.yield v933; + scf.yield v926; }; - v940 = arith.constant 0 : u32; - v938 = arith.eq v931, v940 : i1; - cf.cond_br v938 ^block29, ^block129; + v933 = arith.constant 0 : u32; + v931 = arith.eq v924, v933 : i1; + cf.cond_br v931 ^block29, ^block129; ^block29: ub.unreachable ; ^block129: @@ -508,747 +503,747 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block37: - v381 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v382 = hir.bitcast v381 : ptr; - v383 = hir.load v382 : i32; - v384 = arith.constant 1048692 : i32; - v385 = arith.add v383, v384 : i32 #[overflow = wrapping]; - v386 = hir.bitcast v385 : u32; - v387 = hir.int_to_ptr v386 : ptr; - v388 = hir.load v387 : u8; - v380 = arith.constant 0 : i32; - v389 = arith.zext v388 : u32; - v390 = hir.bitcast v389 : i32; - v392 = arith.neq v390, v380 : i1; - scf.if v392{ + v374 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v375 = hir.bitcast v374 : ptr; + v376 = hir.load v375 : i32; + v377 = arith.constant 1048620 : i32; + v378 = arith.add v376, v377 : i32 #[overflow = wrapping]; + v379 = hir.bitcast v378 : u32; + v380 = hir.int_to_ptr v379 : ptr; + v381 = hir.load v380 : u8; + v373 = arith.constant 0 : i32; + v382 = arith.zext v381 : u32; + v383 = hir.bitcast v382 : i32; + v385 = arith.neq v383, v373 : i1; + scf.if v385{ ^block39: scf.yield ; } else { ^block40: - v393 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v394 = hir.bitcast v393 : ptr; - v395 = hir.load v394 : i32; + v386 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v387 = hir.bitcast v386 : ptr; + v388 = hir.load v387 : i32; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__wasm_call_ctors() - v1004 = arith.constant 1 : u8; - v1006 = arith.constant 1048692 : i32; - v397 = arith.add v395, v1006 : i32 #[overflow = wrapping]; - v401 = hir.bitcast v397 : u32; - v402 = hir.int_to_ptr v401 : ptr; - hir.store v402, v1004; + v997 = arith.constant 1 : u8; + v999 = arith.constant 1048620 : i32; + v390 = arith.add v388, v999 : i32 #[overflow = wrapping]; + v394 = hir.bitcast v390 : u32; + v395 = hir.int_to_ptr v394 : ptr; + hir.store v395, v997; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v403: i32, v404: i32, v405: i32) -> i32 { - ^block41(v403: i32, v404: i32, v405: i32): - v408 = arith.constant 16 : i32; - v407 = arith.constant 0 : i32; - v1008 = arith.constant 16 : u32; - v410 = hir.bitcast v404 : u32; - v412 = arith.gt v410, v1008 : i1; - v413 = arith.zext v412 : u32; - v414 = hir.bitcast v413 : i32; - v416 = arith.neq v414, v407 : i1; - v417 = cf.select v416, v404, v408 : i32; - v1048 = arith.constant 0 : i32; - v418 = arith.constant -1 : i32; - v419 = arith.add v417, v418 : i32 #[overflow = wrapping]; - v420 = arith.band v417, v419 : i32; - v422 = arith.neq v420, v1048 : i1; - v1017, v1018 = scf.if v422 : i32, u32 { + private builtin.function @::alloc(v396: i32, v397: i32, v398: i32) -> i32 { + ^block41(v396: i32, v397: i32, v398: i32): + v401 = arith.constant 16 : i32; + v400 = arith.constant 0 : i32; + v1001 = arith.constant 16 : u32; + v403 = hir.bitcast v397 : u32; + v405 = arith.gt v403, v1001 : i1; + v406 = arith.zext v405 : u32; + v407 = hir.bitcast v406 : i32; + v409 = arith.neq v407, v400 : i1; + v410 = cf.select v409, v397, v401 : i32; + v1041 = arith.constant 0 : i32; + v411 = arith.constant -1 : i32; + v412 = arith.add v410, v411 : i32 #[overflow = wrapping]; + v413 = arith.band v410, v412 : i32; + v415 = arith.neq v413, v1041 : i1; + v1010, v1011 = scf.if v415 : i32, u32 { ^block137: - v1009 = arith.constant 0 : u32; - v1013 = ub.poison i32 : i32; - scf.yield v1013, v1009; + v1002 = arith.constant 0 : u32; + v1006 = ub.poison i32 : i32; + scf.yield v1006, v1002; } else { ^block44: - v424 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::ptr::alignment::Alignment::max(v404, v417) : i32 - v1047 = arith.constant 0 : i32; - v423 = arith.constant -2147483648 : i32; - v425 = arith.sub v423, v424 : i32 #[overflow = wrapping]; - v427 = hir.bitcast v425 : u32; - v426 = hir.bitcast v405 : u32; - v428 = arith.gt v426, v427 : i1; - v429 = arith.zext v428 : u32; - v430 = hir.bitcast v429 : i32; - v432 = arith.neq v430, v1047 : i1; - v1032 = scf.if v432 : i32 { + v417 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::ptr::alignment::Alignment::max(v397, v410) : i32 + v1040 = arith.constant 0 : i32; + v416 = arith.constant -2147483648 : i32; + v418 = arith.sub v416, v417 : i32 #[overflow = wrapping]; + v420 = hir.bitcast v418 : u32; + v419 = hir.bitcast v398 : u32; + v421 = arith.gt v419, v420 : i1; + v422 = arith.zext v421 : u32; + v423 = hir.bitcast v422 : i32; + v425 = arith.neq v423, v1040 : i1; + v1025 = scf.if v425 : i32 { ^block136: - v1046 = ub.poison i32 : i32; - scf.yield v1046; + v1039 = ub.poison i32 : i32; + scf.yield v1039; } else { ^block45: - v1044 = arith.constant 0 : i32; - v438 = arith.sub v1044, v424 : i32 #[overflow = wrapping]; - v1045 = arith.constant -1 : i32; - v434 = arith.add v405, v424 : i32 #[overflow = wrapping]; - v436 = arith.add v434, v1045 : i32 #[overflow = wrapping]; - v439 = arith.band v436, v438 : i32; - v440 = hir.bitcast v403 : u32; - v441 = arith.constant 4 : u32; - v442 = arith.mod v440, v441 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - v444 = hir.load v443 : i32; - v1043 = arith.constant 0 : i32; - v446 = arith.neq v444, v1043 : i1; - scf.if v446{ + v1037 = arith.constant 0 : i32; + v431 = arith.sub v1037, v417 : i32 #[overflow = wrapping]; + v1038 = arith.constant -1 : i32; + v427 = arith.add v398, v417 : i32 #[overflow = wrapping]; + v429 = arith.add v427, v1038 : i32 #[overflow = wrapping]; + v432 = arith.band v429, v431 : i32; + v433 = hir.bitcast v396 : u32; + v434 = arith.constant 4 : u32; + v435 = arith.mod v433, v434 : u32; + hir.assertz v435 #[code = 250]; + v436 = hir.int_to_ptr v433 : ptr; + v437 = hir.load v436 : i32; + v1036 = arith.constant 0 : i32; + v439 = arith.neq v437, v1036 : i1; + scf.if v439{ ^block135: scf.yield ; } else { ^block47: - v447 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 - v448 = hir.mem_size : u32; - v454 = hir.bitcast v403 : u32; - v1042 = arith.constant 4 : u32; - v456 = arith.mod v454, v1042 : u32; - hir.assertz v456 #[code = 250]; - v1041 = arith.constant 16 : u32; - v449 = hir.bitcast v448 : i32; - v452 = arith.shl v449, v1041 : i32; - v453 = arith.add v447, v452 : i32 #[overflow = wrapping]; - v457 = hir.int_to_ptr v454 : ptr; - hir.store v457, v453; + v440 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 + v441 = hir.mem_size : u32; + v447 = hir.bitcast v396 : u32; + v1035 = arith.constant 4 : u32; + v449 = arith.mod v447, v1035 : u32; + hir.assertz v449 #[code = 250]; + v1034 = arith.constant 16 : u32; + v442 = hir.bitcast v441 : i32; + v445 = arith.shl v442, v1034 : i32; + v446 = arith.add v440, v445 : i32 #[overflow = wrapping]; + v450 = hir.int_to_ptr v447 : ptr; + hir.store v450, v446; scf.yield ; }; - v460 = hir.bitcast v403 : u32; - v1040 = arith.constant 4 : u32; - v462 = arith.mod v460, v1040 : u32; - hir.assertz v462 #[code = 250]; - v463 = hir.int_to_ptr v460 : ptr; - v464 = hir.load v463 : i32; - v1038 = arith.constant 0 : i32; - v1039 = arith.constant -1 : i32; - v466 = arith.bxor v464, v1039 : i32; - v468 = hir.bitcast v466 : u32; - v467 = hir.bitcast v439 : u32; - v469 = arith.gt v467, v468 : i1; - v470 = arith.zext v469 : u32; - v471 = hir.bitcast v470 : i32; - v473 = arith.neq v471, v1038 : i1; - v1031 = scf.if v473 : i32 { + v453 = hir.bitcast v396 : u32; + v1033 = arith.constant 4 : u32; + v455 = arith.mod v453, v1033 : u32; + hir.assertz v455 #[code = 250]; + v456 = hir.int_to_ptr v453 : ptr; + v457 = hir.load v456 : i32; + v1031 = arith.constant 0 : i32; + v1032 = arith.constant -1 : i32; + v459 = arith.bxor v457, v1032 : i32; + v461 = hir.bitcast v459 : u32; + v460 = hir.bitcast v432 : u32; + v462 = arith.gt v460, v461 : i1; + v463 = arith.zext v462 : u32; + v464 = hir.bitcast v463 : i32; + v466 = arith.neq v464, v1031 : i1; + v1024 = scf.if v466 : i32 { ^block48: - v1037 = arith.constant 0 : i32; - scf.yield v1037; + v1030 = arith.constant 0 : i32; + scf.yield v1030; } else { ^block49: - v475 = hir.bitcast v403 : u32; - v1036 = arith.constant 4 : u32; - v477 = arith.mod v475, v1036 : u32; - hir.assertz v477 #[code = 250]; - v474 = arith.add v464, v439 : i32 #[overflow = wrapping]; - v478 = hir.int_to_ptr v475 : ptr; - hir.store v478, v474; - v480 = arith.add v464, v424 : i32 #[overflow = wrapping]; - scf.yield v480; + v468 = hir.bitcast v396 : u32; + v1029 = arith.constant 4 : u32; + v470 = arith.mod v468, v1029 : u32; + hir.assertz v470 #[code = 250]; + v467 = arith.add v457, v432 : i32 #[overflow = wrapping]; + v471 = hir.int_to_ptr v468 : ptr; + hir.store v471, v467; + v473 = arith.add v457, v417 : i32 #[overflow = wrapping]; + scf.yield v473; }; - scf.yield v1031; + scf.yield v1024; }; - v1014 = arith.constant 1 : u32; - v1035 = arith.constant 0 : u32; - v1033 = cf.select v432, v1035, v1014 : u32; - scf.yield v1032, v1033; + v1007 = arith.constant 1 : u32; + v1028 = arith.constant 0 : u32; + v1026 = cf.select v425, v1028, v1007 : u32; + scf.yield v1025, v1026; }; - v1034 = arith.constant 0 : u32; - v1030 = arith.eq v1018, v1034 : i1; - cf.cond_br v1030 ^block43, ^block139(v1017); + v1027 = arith.constant 0 : u32; + v1023 = arith.eq v1011, v1027 : i1; + cf.cond_br v1023 ^block43, ^block139(v1010); ^block43: ub.unreachable ; - ^block139(v1010: i32): - builtin.ret v1010; + ^block139(v1003: i32): + builtin.ret v1003; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block50: - v483 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v483; + v476 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v476; }; - private builtin.function @miden_base_sys::bindings::output_note::create(v485: felt, v486: felt, v487: felt, v488: felt, v489: i32) -> felt { - ^block54(v485: felt, v486: felt, v487: felt, v488: felt, v489: i32): - v492 = arith.constant 12 : u32; - v491 = hir.bitcast v489 : u32; + private builtin.function @miden_base_sys::bindings::output_note::create(v478: felt, v479: felt, v480: felt, v481: felt, v482: i32) -> felt { + ^block54(v478: felt, v479: felt, v480: felt, v481: felt, v482: i32): + v485 = arith.constant 12 : u32; + v484 = hir.bitcast v482 : u32; + v486 = arith.add v484, v485 : u32 #[overflow = checked]; + v487 = arith.constant 4 : u32; + v488 = arith.mod v486, v487 : u32; + hir.assertz v488 #[code = 250]; + v489 = hir.int_to_ptr v486 : ptr; + v490 = hir.load v489 : felt; + v492 = arith.constant 8 : u32; + v491 = hir.bitcast v482 : u32; v493 = arith.add v491, v492 : u32 #[overflow = checked]; - v494 = arith.constant 4 : u32; - v495 = arith.mod v493, v494 : u32; + v1045 = arith.constant 4 : u32; + v495 = arith.mod v493, v1045 : u32; hir.assertz v495 #[code = 250]; v496 = hir.int_to_ptr v493 : ptr; v497 = hir.load v496 : felt; - v499 = arith.constant 8 : u32; - v498 = hir.bitcast v489 : u32; - v500 = arith.add v498, v499 : u32 #[overflow = checked]; - v1052 = arith.constant 4 : u32; - v502 = arith.mod v500, v1052 : u32; + v1044 = arith.constant 4 : u32; + v498 = hir.bitcast v482 : u32; + v500 = arith.add v498, v1044 : u32 #[overflow = checked]; + v1043 = arith.constant 4 : u32; + v502 = arith.mod v500, v1043 : u32; hir.assertz v502 #[code = 250]; v503 = hir.int_to_ptr v500 : ptr; v504 = hir.load v503 : felt; - v1051 = arith.constant 4 : u32; - v505 = hir.bitcast v489 : u32; - v507 = arith.add v505, v1051 : u32 #[overflow = checked]; - v1050 = arith.constant 4 : u32; - v509 = arith.mod v507, v1050 : u32; - hir.assertz v509 #[code = 250]; - v510 = hir.int_to_ptr v507 : ptr; - v511 = hir.load v510 : felt; - v512 = hir.bitcast v489 : u32; - v1049 = arith.constant 4 : u32; - v514 = arith.mod v512, v1049 : u32; - hir.assertz v514 #[code = 250]; - v515 = hir.int_to_ptr v512 : ptr; - v516 = hir.load v515 : felt; - v517 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::output_note::create(v485, v486, v487, v488, v497, v504, v511, v516) : felt - builtin.ret v517; + v505 = hir.bitcast v482 : u32; + v1042 = arith.constant 4 : u32; + v507 = arith.mod v505, v1042 : u32; + hir.assertz v507 #[code = 250]; + v508 = hir.int_to_ptr v505 : ptr; + v509 = hir.load v508 : felt; + v510 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::output_note::create(v478, v479, v480, v481, v490, v497, v504, v509) : felt + builtin.ret v510; }; - private builtin.function @>::from(v518: i32, v519: i32) { - ^block56(v518: i32, v519: i32): - v521 = arith.constant 8 : u32; - v520 = hir.bitcast v519 : u32; - v522 = arith.add v520, v521 : u32 #[overflow = checked]; - v523 = arith.constant 4 : u32; - v524 = arith.mod v522, v523 : u32; + private builtin.function @>::from(v511: i32, v512: i32) { + ^block56(v511: i32, v512: i32): + v514 = arith.constant 8 : u32; + v513 = hir.bitcast v512 : u32; + v515 = arith.add v513, v514 : u32 #[overflow = checked]; + v516 = arith.constant 4 : u32; + v517 = arith.mod v515, v516 : u32; + hir.assertz v517 #[code = 250]; + v518 = hir.int_to_ptr v515 : ptr; + v519 = hir.load v518 : i64; + v1049 = arith.constant 8 : u32; + v520 = hir.bitcast v511 : u32; + v522 = arith.add v520, v1049 : u32 #[overflow = checked]; + v1048 = arith.constant 8 : u32; + v524 = arith.mod v522, v1048 : u32; hir.assertz v524 #[code = 250]; v525 = hir.int_to_ptr v522 : ptr; - v526 = hir.load v525 : i64; - v1056 = arith.constant 8 : u32; - v527 = hir.bitcast v518 : u32; - v529 = arith.add v527, v1056 : u32 #[overflow = checked]; - v1055 = arith.constant 8 : u32; - v531 = arith.mod v529, v1055 : u32; - hir.assertz v531 #[code = 250]; - v532 = hir.int_to_ptr v529 : ptr; - hir.store v532, v526; - v533 = hir.bitcast v519 : u32; - v1054 = arith.constant 4 : u32; - v535 = arith.mod v533, v1054 : u32; - hir.assertz v535 #[code = 250]; - v536 = hir.int_to_ptr v533 : ptr; - v537 = hir.load v536 : i64; - v538 = hir.bitcast v518 : u32; - v1053 = arith.constant 8 : u32; - v540 = arith.mod v538, v1053 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - hir.store v541, v537; + hir.store v525, v519; + v526 = hir.bitcast v512 : u32; + v1047 = arith.constant 4 : u32; + v528 = arith.mod v526, v1047 : u32; + hir.assertz v528 #[code = 250]; + v529 = hir.int_to_ptr v526 : ptr; + v530 = hir.load v529 : i64; + v531 = hir.bitcast v511 : u32; + v1046 = arith.constant 8 : u32; + v533 = arith.mod v531, v1046 : u32; + hir.assertz v533 #[code = 250]; + v534 = hir.int_to_ptr v531 : ptr; + hir.store v534, v530; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v542: i64) -> felt { - ^block58(v542: i64): - v543 = hir.cast v542 : felt; - builtin.ret v543; + private builtin.function @intrinsics::felt::from_u64_unchecked(v535: i64) -> felt { + ^block58(v535: i64): + v536 = hir.cast v535 : felt; + builtin.ret v536; }; - private builtin.function @intrinsics::felt::from_u32(v545: i32) -> felt { - ^block60(v545: i32): - v546 = hir.bitcast v545 : felt; - builtin.ret v546; + private builtin.function @intrinsics::felt::from_u32(v538: i32) -> felt { + ^block60(v538: i32): + v539 = hir.bitcast v538 : felt; + builtin.ret v539; }; - private builtin.function @intrinsics::felt::as_u64(v548: felt) -> i64 { - ^block62(v548: felt): - v549 = hir.cast v548 : i64; - builtin.ret v549; + private builtin.function @intrinsics::felt::as_u64(v541: felt) -> i64 { + ^block62(v541: felt): + v542 = hir.cast v541 : i64; + builtin.ret v542; }; - private builtin.function @intrinsics::felt::assert_eq(v551: felt, v552: felt) { - ^block64(v551: felt, v552: felt): - hir.assert_eq v551, v552; + private builtin.function @intrinsics::felt::assert_eq(v544: felt, v545: felt) { + ^block64(v544: felt, v545: felt): + hir.assert_eq v544, v545; builtin.ret ; }; - private builtin.function @intrinsics::advice::adv_push_mapvaln(v553: felt, v554: felt, v555: felt, v556: felt) -> felt { - ^block66(v553: felt, v554: felt, v555: felt, v556: felt): - v557 = hir.exec @intrinsics/advice/adv_push_mapvaln(v553, v554, v555, v556) : felt - builtin.ret v557; + private builtin.function @intrinsics::advice::adv_push_mapvaln(v546: felt, v547: felt, v548: felt, v549: felt) -> felt { + ^block66(v546: felt, v547: felt, v548: felt, v549: felt): + v550 = hir.exec @intrinsics/advice/adv_push_mapvaln(v546, v547, v548, v549) : felt + builtin.ret v550; }; - private builtin.function @std::mem::pipe_preimage_to_memory(v559: felt, v560: i32, v561: felt, v562: felt, v563: felt, v564: felt) -> i32 { - ^block69(v559: felt, v560: i32, v561: felt, v562: felt, v563: felt, v564: felt): - v565 = hir.exec @std/mem/pipe_preimage_to_memory(v559, v560, v561, v562, v563, v564) : i32 - builtin.ret v565; + private builtin.function @std::mem::pipe_preimage_to_memory(v552: felt, v553: i32, v554: felt, v555: felt, v556: felt, v557: felt) -> i32 { + ^block69(v552: felt, v553: i32, v554: felt, v555: felt, v556: felt, v557: felt): + v558 = hir.exec @std/mem/pipe_preimage_to_memory(v552, v553, v554, v555, v556, v557) : i32 + builtin.ret v558; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v567: i32, v568: i32, v569: i32) { - ^block73(v567: i32, v568: i32, v569: i32): - v571 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v572 = hir.bitcast v571 : ptr; - v573 = hir.load v572 : i32; - v574 = arith.constant 16 : i32; - v575 = arith.sub v573, v574 : i32 #[overflow = wrapping]; - v576 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v577 = hir.bitcast v576 : ptr; - hir.store v577, v575; - v578 = arith.constant 4 : i32; - v579 = arith.add v575, v578 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::current_memory(v579, v567, v568, v569) - v581 = arith.constant 8 : u32; - v580 = hir.bitcast v575 : u32; - v582 = arith.add v580, v581 : u32 #[overflow = checked]; - v583 = arith.constant 4 : u32; - v584 = arith.mod v582, v583 : u32; - hir.assertz v584 #[code = 250]; - v585 = hir.int_to_ptr v582 : ptr; - v586 = hir.load v585 : i32; - v1063 = arith.constant 0 : i32; - v570 = arith.constant 0 : i32; - v588 = arith.eq v586, v570 : i1; - v589 = arith.zext v588 : u32; - v590 = hir.bitcast v589 : i32; - v592 = arith.neq v590, v1063 : i1; - scf.if v592{ + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v560: i32, v561: i32, v562: i32) { + ^block73(v560: i32, v561: i32, v562: i32): + v564 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v565 = hir.bitcast v564 : ptr; + v566 = hir.load v565 : i32; + v567 = arith.constant 16 : i32; + v568 = arith.sub v566, v567 : i32 #[overflow = wrapping]; + v569 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v570 = hir.bitcast v569 : ptr; + hir.store v570, v568; + v571 = arith.constant 4 : i32; + v572 = arith.add v568, v571 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::current_memory(v572, v560, v561, v562) + v574 = arith.constant 8 : u32; + v573 = hir.bitcast v568 : 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 : i32; + v1056 = arith.constant 0 : i32; + v563 = arith.constant 0 : i32; + v581 = arith.eq v579, v563 : i1; + v582 = arith.zext v581 : u32; + v583 = hir.bitcast v582 : i32; + v585 = arith.neq v583, v1056 : i1; + scf.if v585{ ^block143: scf.yield ; } else { ^block76: - v1062 = arith.constant 4 : u32; - v593 = hir.bitcast v575 : u32; - v595 = arith.add v593, v1062 : u32 #[overflow = checked]; - v1061 = arith.constant 4 : u32; - v597 = arith.mod v595, v1061 : u32; + v1055 = arith.constant 4 : u32; + v586 = hir.bitcast v568 : u32; + v588 = arith.add v586, v1055 : u32 #[overflow = checked]; + v1054 = arith.constant 4 : u32; + v590 = arith.mod v588, v1054 : u32; + hir.assertz v590 #[code = 250]; + v591 = hir.int_to_ptr v588 : ptr; + v592 = hir.load v591 : i32; + v594 = arith.constant 12 : u32; + v593 = hir.bitcast v568 : u32; + v595 = arith.add v593, v594 : u32 #[overflow = checked]; + v1053 = arith.constant 4 : u32; + v597 = arith.mod v595, v1053 : u32; hir.assertz v597 #[code = 250]; v598 = hir.int_to_ptr v595 : ptr; v599 = hir.load v598 : i32; - v601 = arith.constant 12 : u32; - v600 = hir.bitcast v575 : u32; - v602 = arith.add v600, v601 : u32 #[overflow = checked]; - v1060 = arith.constant 4 : u32; - v604 = arith.mod v602, v1060 : u32; - hir.assertz v604 #[code = 250]; - v605 = hir.int_to_ptr v602 : ptr; - v606 = hir.load v605 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v599, v586, v606) + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v592, v579, v599) scf.yield ; }; - v1059 = arith.constant 16 : i32; - v609 = arith.add v575, v1059 : i32 #[overflow = wrapping]; - v610 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v611 = hir.bitcast v610 : ptr; - hir.store v611, v609; + v1052 = arith.constant 16 : i32; + v602 = arith.add v568, v1052 : i32 #[overflow = wrapping]; + v603 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v604 = hir.bitcast v603 : ptr; + hir.store v604, v602; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v612: i32, v613: i32, v614: i32, v615: i32, v616: i32) { - ^block77(v612: i32, v613: i32, v614: i32, v615: i32, v616: i32): - v619 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v620 = hir.bitcast v619 : ptr; - v621 = hir.load v620 : i32; - v622 = arith.constant 16 : i32; - v623 = arith.sub v621, v622 : i32 #[overflow = wrapping]; - v624 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v625 = hir.bitcast v624 : ptr; - hir.store v625, v623; - v635 = hir.bitcast v613 : u32; - v636 = arith.zext v635 : u64; - v637 = hir.bitcast v636 : i64; - v617 = arith.constant 0 : i32; - v630 = arith.sub v617, v615 : i32 #[overflow = wrapping]; - v627 = arith.constant -1 : i32; - v626 = arith.add v615, v616 : i32 #[overflow = wrapping]; - v628 = arith.add v626, v627 : i32 #[overflow = wrapping]; - v631 = arith.band v628, v630 : i32; - v632 = hir.bitcast v631 : u32; - v633 = arith.zext v632 : u64; - v634 = hir.bitcast v633 : i64; - v638 = arith.mul v634, v637 : i64 #[overflow = wrapping]; - v1167 = arith.constant 0 : i32; - v639 = arith.constant 32 : i64; - v641 = hir.cast v639 : u32; - v640 = hir.bitcast v638 : u64; - v642 = arith.shr v640, v641 : u64; - v643 = hir.bitcast v642 : i64; - v644 = arith.trunc v643 : i32; - v646 = arith.neq v644, v1167 : i1; - v1079, v1080, v1081, v1082, v1083, v1084 = scf.if v646 : i32, i32, i32, i32, i32, u32 { + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v605: i32, v606: i32, v607: i32, v608: i32, v609: i32) { + ^block77(v605: i32, v606: i32, v607: i32, v608: i32, v609: i32): + v612 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v613 = hir.bitcast v612 : ptr; + v614 = hir.load v613 : i32; + v615 = arith.constant 16 : i32; + v616 = arith.sub v614, v615 : i32 #[overflow = wrapping]; + v617 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v618 = hir.bitcast v617 : ptr; + hir.store v618, v616; + v628 = hir.bitcast v606 : u32; + v629 = arith.zext v628 : u64; + v630 = hir.bitcast v629 : i64; + v610 = arith.constant 0 : i32; + v623 = arith.sub v610, v608 : i32 #[overflow = wrapping]; + v620 = arith.constant -1 : i32; + v619 = arith.add v608, v609 : i32 #[overflow = wrapping]; + v621 = arith.add v619, v620 : i32 #[overflow = wrapping]; + v624 = arith.band v621, v623 : i32; + v625 = hir.bitcast v624 : u32; + v626 = arith.zext v625 : u64; + v627 = hir.bitcast v626 : i64; + v631 = arith.mul v627, v630 : i64 #[overflow = wrapping]; + v1160 = arith.constant 0 : i32; + v632 = arith.constant 32 : i64; + v634 = hir.cast v632 : u32; + v633 = hir.bitcast v631 : u64; + v635 = arith.shr v633, v634 : u64; + v636 = hir.bitcast v635 : i64; + v637 = arith.trunc v636 : i32; + v639 = arith.neq v637, v1160 : i1; + v1072, v1073, v1074, v1075, v1076, v1077 = scf.if v639 : i32, i32, i32, i32, i32, u32 { ^block145: - v1064 = arith.constant 0 : u32; - v1071 = ub.poison i32 : i32; - scf.yield v612, v623, v1071, v1071, v1071, v1064; + v1057 = arith.constant 0 : u32; + v1064 = ub.poison i32 : i32; + scf.yield v605, v616, v1064, v1064, v1064, v1057; } else { ^block82: - v647 = arith.trunc v638 : i32; - v1166 = arith.constant 0 : i32; - v648 = arith.constant -2147483648 : i32; - v649 = arith.sub v648, v615 : i32 #[overflow = wrapping]; - v651 = hir.bitcast v649 : u32; - v650 = hir.bitcast v647 : u32; - v652 = arith.lte v650, v651 : i1; - v653 = arith.zext v652 : u32; - v654 = hir.bitcast v653 : i32; - v656 = arith.neq v654, v1166 : i1; - v1127 = scf.if v656 : i32 { + v640 = arith.trunc v631 : i32; + v1159 = arith.constant 0 : i32; + v641 = arith.constant -2147483648 : i32; + v642 = arith.sub v641, v608 : i32 #[overflow = wrapping]; + v644 = hir.bitcast v642 : u32; + v643 = hir.bitcast v640 : u32; + v645 = arith.lte v643, v644 : i1; + v646 = arith.zext v645 : u32; + v647 = hir.bitcast v646 : i32; + v649 = arith.neq v647, v1159 : i1; + v1120 = scf.if v649 : i32 { ^block80: - v1165 = arith.constant 0 : i32; - v667 = arith.neq v647, v1165 : i1; - v1126 = scf.if v667 : i32 { + v1158 = arith.constant 0 : i32; + v660 = arith.neq v640, v1158 : i1; + v1119 = scf.if v660 : i32 { ^block84: - v1164 = arith.constant 0 : i32; - v683 = arith.neq v614, v1164 : i1; - v1125 = scf.if v683 : i32 { + v1157 = arith.constant 0 : i32; + v676 = arith.neq v607, v1157 : i1; + v1118 = scf.if v676 : i32 { ^block87: - v665 = arith.constant 1 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v623, v615, v647, v665) - v694 = hir.bitcast v623 : u32; - v739 = arith.constant 4 : u32; - v696 = arith.mod v694, v739 : u32; - hir.assertz v696 #[code = 250]; - v697 = hir.int_to_ptr v694 : ptr; - v698 = hir.load v697 : i32; - scf.yield v698; + v658 = arith.constant 1 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v616, v608, v640, v658) + v687 = hir.bitcast v616 : u32; + v732 = arith.constant 4 : u32; + v689 = arith.mod v687, v732 : u32; + hir.assertz v689 #[code = 250]; + v690 = hir.int_to_ptr v687 : ptr; + v691 = hir.load v690 : i32; + scf.yield v691; } else { ^block88: - v684 = arith.constant 8 : i32; - v685 = arith.add v623, v684 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v685, v615, v647) - v669 = arith.constant 8 : u32; - v686 = hir.bitcast v623 : u32; - v688 = arith.add v686, v669 : u32 #[overflow = checked]; - v1163 = arith.constant 4 : u32; - v690 = arith.mod v688, v1163 : u32; - hir.assertz v690 #[code = 250]; - v691 = hir.int_to_ptr v688 : ptr; - v692 = hir.load v691 : i32; - scf.yield v692; + v677 = arith.constant 8 : i32; + v678 = arith.add v616, v677 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v678, v608, v640) + v662 = arith.constant 8 : u32; + v679 = hir.bitcast v616 : u32; + v681 = arith.add v679, v662 : u32 #[overflow = checked]; + v1156 = arith.constant 4 : u32; + v683 = arith.mod v681, v1156 : u32; + hir.assertz v683 #[code = 250]; + v684 = hir.int_to_ptr v681 : ptr; + v685 = hir.load v684 : i32; + scf.yield v685; }; - v1161 = arith.constant 0 : i32; - v1162 = arith.constant 0 : i32; - v701 = arith.eq v1125, v1162 : i1; - v702 = arith.zext v701 : u32; - v703 = hir.bitcast v702 : i32; - v705 = arith.neq v703, v1161 : i1; - scf.if v705{ + v1154 = arith.constant 0 : i32; + v1155 = arith.constant 0 : i32; + v694 = arith.eq v1118, v1155 : i1; + v695 = arith.zext v694 : u32; + v696 = hir.bitcast v695 : i32; + v698 = arith.neq v696, v1154 : i1; + scf.if v698{ ^block89: - v1160 = arith.constant 8 : u32; - v722 = hir.bitcast v612 : u32; - v724 = arith.add v722, v1160 : u32 #[overflow = checked]; - v1159 = arith.constant 4 : u32; - v726 = arith.mod v724, v1159 : u32; + v1153 = arith.constant 8 : u32; + v715 = hir.bitcast v605 : u32; + v717 = arith.add v715, v1153 : u32 #[overflow = checked]; + v1152 = arith.constant 4 : u32; + v719 = arith.mod v717, v1152 : u32; + hir.assertz v719 #[code = 250]; + v720 = hir.int_to_ptr v717 : ptr; + hir.store v720, v640; + v1151 = arith.constant 4 : u32; + v722 = hir.bitcast v605 : u32; + v724 = arith.add v722, v1151 : u32 #[overflow = checked]; + v1150 = arith.constant 4 : u32; + v726 = arith.mod v724, v1150 : u32; hir.assertz v726 #[code = 250]; v727 = hir.int_to_ptr v724 : ptr; - hir.store v727, v647; - v1158 = arith.constant 4 : u32; - v729 = hir.bitcast v612 : u32; - v731 = arith.add v729, v1158 : u32 #[overflow = checked]; - v1157 = arith.constant 4 : u32; - v733 = arith.mod v731, v1157 : u32; - hir.assertz v733 #[code = 250]; - v734 = hir.int_to_ptr v731 : ptr; - hir.store v734, v615; + hir.store v727, v608; scf.yield ; } else { ^block90: - v1156 = arith.constant 8 : u32; - v707 = hir.bitcast v612 : u32; - v709 = arith.add v707, v1156 : u32 #[overflow = checked]; - v1155 = arith.constant 4 : u32; - v711 = arith.mod v709, v1155 : u32; + v1149 = arith.constant 8 : u32; + v700 = hir.bitcast v605 : u32; + v702 = arith.add v700, v1149 : u32 #[overflow = checked]; + v1148 = arith.constant 4 : u32; + v704 = arith.mod v702, v1148 : u32; + hir.assertz v704 #[code = 250]; + v705 = hir.int_to_ptr v702 : ptr; + hir.store v705, v1118; + v1147 = arith.constant 4 : u32; + v707 = hir.bitcast v605 : u32; + v709 = arith.add v707, v1147 : u32 #[overflow = checked]; + v1146 = arith.constant 4 : u32; + v711 = arith.mod v709, v1146 : u32; hir.assertz v711 #[code = 250]; v712 = hir.int_to_ptr v709 : ptr; - hir.store v712, v1125; - v1154 = arith.constant 4 : u32; - v714 = hir.bitcast v612 : u32; - v716 = arith.add v714, v1154 : u32 #[overflow = checked]; - v1153 = arith.constant 4 : u32; - v718 = arith.mod v716, v1153 : u32; - hir.assertz v718 #[code = 250]; - v719 = hir.int_to_ptr v716 : ptr; - hir.store v719, v613; + hir.store v712, v606; scf.yield ; }; - v1151 = arith.constant 0 : i32; - v1152 = arith.constant 1 : i32; - v1124 = cf.select v705, v1152, v1151 : i32; - scf.yield v1124; + v1144 = arith.constant 0 : i32; + v1145 = arith.constant 1 : i32; + v1117 = cf.select v698, v1145, v1144 : i32; + scf.yield v1117; } else { ^block85: - v1150 = arith.constant 8 : u32; - v668 = hir.bitcast v612 : u32; - v670 = arith.add v668, v1150 : u32 #[overflow = checked]; - v1149 = arith.constant 4 : u32; - v672 = arith.mod v670, v1149 : u32; - hir.assertz v672 #[code = 250]; - v673 = hir.int_to_ptr v670 : ptr; - hir.store v673, v615; - v1148 = arith.constant 4 : u32; - v676 = hir.bitcast v612 : u32; - v678 = arith.add v676, v1148 : u32 #[overflow = checked]; - v1147 = arith.constant 4 : u32; - v680 = arith.mod v678, v1147 : u32; - hir.assertz v680 #[code = 250]; - v1146 = arith.constant 0 : i32; - v681 = hir.int_to_ptr v678 : ptr; - hir.store v681, v1146; - v1145 = arith.constant 0 : i32; - scf.yield v1145; + v1143 = arith.constant 8 : u32; + v661 = hir.bitcast v605 : u32; + v663 = arith.add v661, v1143 : u32 #[overflow = checked]; + v1142 = arith.constant 4 : u32; + v665 = arith.mod v663, v1142 : u32; + hir.assertz v665 #[code = 250]; + v666 = hir.int_to_ptr v663 : ptr; + hir.store v666, v608; + v1141 = arith.constant 4 : u32; + v669 = hir.bitcast v605 : u32; + v671 = arith.add v669, v1141 : u32 #[overflow = checked]; + v1140 = arith.constant 4 : u32; + v673 = arith.mod v671, v1140 : u32; + hir.assertz v673 #[code = 250]; + v1139 = arith.constant 0 : i32; + v674 = hir.int_to_ptr v671 : ptr; + hir.store v674, v1139; + v1138 = arith.constant 0 : i32; + scf.yield v1138; }; - scf.yield v1126; + scf.yield v1119; } else { ^block83: - v1144 = ub.poison i32 : i32; - scf.yield v1144; + v1137 = ub.poison i32 : i32; + scf.yield v1137; }; - v1139 = arith.constant 0 : u32; - v1072 = arith.constant 1 : u32; - v1132 = cf.select v656, v1072, v1139 : u32; - v1140 = ub.poison i32 : i32; - v1131 = cf.select v656, v623, v1140 : i32; - v1141 = ub.poison i32 : i32; - v1130 = cf.select v656, v612, v1141 : i32; - v1142 = ub.poison i32 : i32; - v1129 = cf.select v656, v1142, v623 : i32; - v1143 = ub.poison i32 : i32; - v1128 = cf.select v656, v1143, v612 : i32; - scf.yield v1128, v1129, v1130, v1127, v1131, v1132; + v1132 = arith.constant 0 : u32; + v1065 = arith.constant 1 : u32; + v1125 = cf.select v649, v1065, v1132 : u32; + v1133 = ub.poison i32 : i32; + v1124 = cf.select v649, v616, v1133 : i32; + v1134 = ub.poison i32 : i32; + v1123 = cf.select v649, v605, v1134 : i32; + v1135 = ub.poison i32 : i32; + v1122 = cf.select v649, v1135, v616 : i32; + v1136 = ub.poison i32 : i32; + v1121 = cf.select v649, v1136, v605 : i32; + scf.yield v1121, v1122, v1123, v1120, v1124, v1125; }; - v1085, v1086, v1087 = scf.index_switch v1084 : i32, i32, i32 + v1078, v1079, v1080 = scf.index_switch v1077 : i32, i32, i32 case 0 { ^block81: - v1138 = arith.constant 4 : u32; - v659 = hir.bitcast v1079 : u32; - v661 = arith.add v659, v1138 : u32 #[overflow = checked]; - v1137 = arith.constant 4 : u32; - v663 = arith.mod v661, v1137 : u32; - hir.assertz v663 #[code = 250]; - v1136 = arith.constant 0 : i32; - v664 = hir.int_to_ptr v661 : ptr; - hir.store v664, v1136; - v1135 = arith.constant 1 : i32; - scf.yield v1079, v1135, v1080; + v1131 = arith.constant 4 : u32; + v652 = hir.bitcast v1072 : u32; + v654 = arith.add v652, v1131 : u32 #[overflow = checked]; + v1130 = arith.constant 4 : u32; + v656 = arith.mod v654, v1130 : u32; + hir.assertz v656 #[code = 250]; + v1129 = arith.constant 0 : i32; + v657 = hir.int_to_ptr v654 : ptr; + hir.store v657, v1129; + v1128 = arith.constant 1 : i32; + scf.yield v1072, v1128, v1073; } default { ^block149: - scf.yield v1081, v1082, v1083; + scf.yield v1074, v1075, v1076; }; - v738 = hir.bitcast v1085 : u32; - v1134 = arith.constant 4 : u32; - v740 = arith.mod v738, v1134 : u32; - hir.assertz v740 #[code = 250]; - v741 = hir.int_to_ptr v738 : ptr; - hir.store v741, v1086; - v1133 = arith.constant 16 : i32; - v746 = arith.add v1087, v1133 : i32 #[overflow = wrapping]; - v747 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v748 = hir.bitcast v747 : ptr; - hir.store v748, v746; + v731 = hir.bitcast v1078 : u32; + v1127 = arith.constant 4 : u32; + v733 = arith.mod v731, v1127 : u32; + hir.assertz v733 #[code = 250]; + v734 = hir.int_to_ptr v731 : ptr; + hir.store v734, v1079; + v1126 = arith.constant 16 : i32; + v739 = arith.add v1080, v1126 : i32 #[overflow = wrapping]; + v740 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v741 = hir.bitcast v740 : ptr; + hir.store v741, v739; builtin.ret ; }; - private builtin.function @::allocate(v749: i32, v750: i32, v751: i32) { - ^block91(v749: i32, v750: i32, v751: i32): - v753 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v754 = hir.bitcast v753 : ptr; - v755 = hir.load v754 : i32; - v756 = arith.constant 16 : i32; - v757 = arith.sub v755, v756 : i32 #[overflow = wrapping]; - v758 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v759 = hir.bitcast v758 : ptr; - hir.store v759, v757; - v752 = arith.constant 0 : i32; - v760 = arith.constant 8 : i32; - v761 = arith.add v757, v760 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v761, v750, v751, v752) - v764 = arith.constant 12 : u32; - v763 = hir.bitcast v757 : u32; + private builtin.function @::allocate(v742: i32, v743: i32, v744: i32) { + ^block91(v742: i32, v743: i32, v744: i32): + v746 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v747 = hir.bitcast v746 : ptr; + v748 = hir.load v747 : i32; + v749 = arith.constant 16 : i32; + v750 = arith.sub v748, v749 : i32 #[overflow = wrapping]; + v751 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v752 = hir.bitcast v751 : ptr; + hir.store v752, v750; + v745 = arith.constant 0 : i32; + v753 = arith.constant 8 : i32; + v754 = arith.add v750, v753 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v754, v743, v744, v745) + v757 = arith.constant 12 : u32; + v756 = hir.bitcast v750 : u32; + v758 = arith.add v756, v757 : u32 #[overflow = checked]; + v759 = arith.constant 4 : u32; + v760 = arith.mod v758, v759 : u32; + hir.assertz v760 #[code = 250]; + v761 = hir.int_to_ptr v758 : ptr; + v762 = hir.load v761 : i32; + v764 = arith.constant 8 : u32; + v763 = hir.bitcast v750 : u32; v765 = arith.add v763, v764 : u32 #[overflow = checked]; - v766 = arith.constant 4 : u32; - v767 = arith.mod v765, v766 : u32; + v1165 = arith.constant 4 : u32; + v767 = arith.mod v765, v1165 : u32; hir.assertz v767 #[code = 250]; v768 = hir.int_to_ptr v765 : ptr; v769 = hir.load v768 : i32; - v771 = arith.constant 8 : u32; - v770 = hir.bitcast v757 : u32; - v772 = arith.add v770, v771 : u32 #[overflow = checked]; - v1172 = arith.constant 4 : u32; - v774 = arith.mod v772, v1172 : u32; - hir.assertz v774 #[code = 250]; - v775 = hir.int_to_ptr v772 : ptr; - v776 = hir.load v775 : i32; - v777 = hir.bitcast v749 : u32; - v1171 = arith.constant 4 : u32; - v779 = arith.mod v777, v1171 : u32; - hir.assertz v779 #[code = 250]; - v780 = hir.int_to_ptr v777 : ptr; - hir.store v780, v776; - v1170 = arith.constant 4 : u32; - v781 = hir.bitcast v749 : u32; - v783 = arith.add v781, v1170 : u32 #[overflow = checked]; - v1169 = arith.constant 4 : u32; - v785 = arith.mod v783, v1169 : u32; - hir.assertz v785 #[code = 250]; - v786 = hir.int_to_ptr v783 : ptr; - hir.store v786, v769; - v1168 = arith.constant 16 : i32; - v788 = arith.add v757, v1168 : i32 #[overflow = wrapping]; - v789 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v790 = hir.bitcast v789 : ptr; - hir.store v790, v788; + v770 = hir.bitcast v742 : u32; + v1164 = arith.constant 4 : u32; + v772 = arith.mod v770, v1164 : u32; + hir.assertz v772 #[code = 250]; + v773 = hir.int_to_ptr v770 : ptr; + hir.store v773, v769; + v1163 = arith.constant 4 : u32; + v774 = hir.bitcast v742 : u32; + v776 = arith.add v774, v1163 : u32 #[overflow = checked]; + v1162 = arith.constant 4 : u32; + v778 = arith.mod v776, v1162 : u32; + hir.assertz v778 #[code = 250]; + v779 = hir.int_to_ptr v776 : ptr; + hir.store v779, v762; + v1161 = arith.constant 16 : i32; + v781 = arith.add v750, v1161 : i32 #[overflow = wrapping]; + v782 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v783 = hir.bitcast v782 : ptr; + hir.store v783, v781; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v791: i32, v792: i32, v793: i32, v794: i32) { - ^block93(v791: i32, v792: i32, v793: i32, v794: i32): - v1188 = arith.constant 0 : i32; - v795 = arith.constant 0 : i32; - v796 = arith.eq v793, v795 : i1; - v797 = arith.zext v796 : u32; - v798 = hir.bitcast v797 : i32; - v800 = arith.neq v798, v1188 : i1; - v1184 = scf.if v800 : i32 { + private builtin.function @alloc::alloc::Global::alloc_impl(v784: i32, v785: i32, v786: i32, v787: i32) { + ^block93(v784: i32, v785: i32, v786: i32, v787: i32): + v1181 = arith.constant 0 : i32; + v788 = arith.constant 0 : i32; + v789 = arith.eq v786, v788 : i1; + v790 = arith.zext v789 : u32; + v791 = hir.bitcast v790 : i32; + v793 = arith.neq v791, v1181 : i1; + v1177 = scf.if v793 : i32 { ^block152: - scf.yield v792; + scf.yield v785; } else { ^block96: hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1187 = arith.constant 0 : i32; - v802 = arith.neq v794, v1187 : i1; - v1183 = scf.if v802 : i32 { + v1180 = arith.constant 0 : i32; + v795 = arith.neq v787, v1180 : i1; + v1176 = scf.if v795 : i32 { ^block97: - v804 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v793, v792) : i32 - scf.yield v804; + v797 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v786, v785) : i32 + scf.yield v797; } else { ^block98: - v803 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v793, v792) : i32 - scf.yield v803; + v796 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v786, v785) : i32 + scf.yield v796; }; - scf.yield v1183; + scf.yield v1176; }; - v808 = arith.constant 4 : u32; - v807 = hir.bitcast v791 : u32; - v809 = arith.add v807, v808 : u32 #[overflow = checked]; - v1186 = arith.constant 4 : u32; - v811 = arith.mod v809, v1186 : u32; - hir.assertz v811 #[code = 250]; - v812 = hir.int_to_ptr v809 : ptr; - hir.store v812, v793; - v814 = hir.bitcast v791 : u32; - v1185 = arith.constant 4 : u32; - v816 = arith.mod v814, v1185 : u32; - hir.assertz v816 #[code = 250]; - v817 = hir.int_to_ptr v814 : ptr; - hir.store v817, v1184; + v801 = arith.constant 4 : u32; + v800 = hir.bitcast v784 : u32; + v802 = arith.add v800, v801 : u32 #[overflow = checked]; + v1179 = arith.constant 4 : u32; + v804 = arith.mod v802, v1179 : u32; + hir.assertz v804 #[code = 250]; + v805 = hir.int_to_ptr v802 : ptr; + hir.store v805, v786; + v807 = hir.bitcast v784 : u32; + v1178 = arith.constant 4 : u32; + v809 = arith.mod v807, v1178 : u32; + hir.assertz v809 #[code = 250]; + v810 = hir.int_to_ptr v807 : ptr; + hir.store v810, v1177; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v818: i32, v819: i32, v820: i32, v821: i32) { - ^block99(v818: i32, v819: i32, v820: i32, v821: i32): - v1214 = arith.constant 0 : i32; - v822 = arith.constant 0 : i32; - v826 = arith.eq v821, v822 : i1; - v827 = arith.zext v826 : u32; - v828 = hir.bitcast v827 : i32; - v830 = arith.neq v828, v1214 : i1; - v1201, v1202 = scf.if v830 : i32, i32 { + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v811: i32, v812: i32, v813: i32, v814: i32) { + ^block99(v811: i32, v812: i32, v813: i32, v814: i32): + v1207 = arith.constant 0 : i32; + v815 = arith.constant 0 : i32; + v819 = arith.eq v814, v815 : i1; + v820 = arith.zext v819 : u32; + v821 = hir.bitcast v820 : i32; + v823 = arith.neq v821, v1207 : i1; + v1194, v1195 = scf.if v823 : i32, i32 { ^block156: - v1213 = arith.constant 0 : i32; - v824 = arith.constant 4 : i32; - scf.yield v824, v1213; + v1206 = arith.constant 0 : i32; + v817 = arith.constant 4 : i32; + scf.yield v817, v1206; } else { ^block102: - v831 = hir.bitcast v819 : u32; - v866 = arith.constant 4 : u32; - v833 = arith.mod v831, v866 : u32; - hir.assertz v833 #[code = 250]; - v834 = hir.int_to_ptr v831 : ptr; - v835 = hir.load v834 : i32; - v1211 = arith.constant 0 : i32; - v1212 = arith.constant 0 : i32; - v837 = arith.eq v835, v1212 : i1; - v838 = arith.zext v837 : u32; - v839 = hir.bitcast v838 : i32; - v841 = arith.neq v839, v1211 : i1; - v1199 = scf.if v841 : i32 { + v824 = hir.bitcast v812 : u32; + v859 = arith.constant 4 : u32; + v826 = arith.mod v824, v859 : u32; + hir.assertz v826 #[code = 250]; + v827 = hir.int_to_ptr v824 : ptr; + v828 = hir.load v827 : i32; + v1204 = arith.constant 0 : i32; + v1205 = arith.constant 0 : i32; + v830 = arith.eq v828, v1205 : i1; + v831 = arith.zext v830 : u32; + v832 = hir.bitcast v831 : i32; + v834 = arith.neq v832, v1204 : i1; + v1192 = scf.if v834 : i32 { ^block155: - v1210 = arith.constant 0 : i32; - scf.yield v1210; + v1203 = arith.constant 0 : i32; + scf.yield v1203; } else { ^block103: - v1209 = arith.constant 4 : u32; - v842 = hir.bitcast v818 : u32; - v844 = arith.add v842, v1209 : u32 #[overflow = checked]; - v1208 = arith.constant 4 : u32; - v846 = arith.mod v844, v1208 : u32; - hir.assertz v846 #[code = 250]; - v847 = hir.int_to_ptr v844 : ptr; - hir.store v847, v820; - v1207 = arith.constant 4 : u32; - v848 = hir.bitcast v819 : u32; - v850 = arith.add v848, v1207 : u32 #[overflow = checked]; - v1206 = arith.constant 4 : u32; - v852 = arith.mod v850, v1206 : u32; - hir.assertz v852 #[code = 250]; - v853 = hir.int_to_ptr v850 : ptr; - v854 = hir.load v853 : i32; - v855 = hir.bitcast v818 : u32; - v1205 = arith.constant 4 : u32; - v857 = arith.mod v855, v1205 : u32; - hir.assertz v857 #[code = 250]; - v858 = hir.int_to_ptr v855 : ptr; - hir.store v858, v854; - v859 = arith.mul v835, v821 : i32 #[overflow = wrapping]; - scf.yield v859; + v1202 = arith.constant 4 : u32; + v835 = hir.bitcast v811 : u32; + v837 = arith.add v835, v1202 : u32 #[overflow = checked]; + v1201 = arith.constant 4 : u32; + v839 = arith.mod v837, v1201 : u32; + hir.assertz v839 #[code = 250]; + v840 = hir.int_to_ptr v837 : ptr; + hir.store v840, v813; + v1200 = arith.constant 4 : u32; + v841 = hir.bitcast v812 : u32; + v843 = arith.add v841, v1200 : u32 #[overflow = checked]; + v1199 = arith.constant 4 : u32; + v845 = arith.mod v843, v1199 : u32; + hir.assertz v845 #[code = 250]; + v846 = hir.int_to_ptr v843 : ptr; + v847 = hir.load v846 : i32; + v848 = hir.bitcast v811 : u32; + v1198 = arith.constant 4 : u32; + v850 = arith.mod v848, v1198 : u32; + hir.assertz v850 #[code = 250]; + v851 = hir.int_to_ptr v848 : ptr; + hir.store v851, v847; + v852 = arith.mul v828, v814 : i32 #[overflow = wrapping]; + scf.yield v852; }; - v860 = arith.constant 8 : i32; - v1204 = arith.constant 4 : i32; - v1200 = cf.select v841, v1204, v860 : i32; - scf.yield v1200, v1199; + v853 = arith.constant 8 : i32; + v1197 = arith.constant 4 : i32; + v1193 = cf.select v834, v1197, v853 : i32; + scf.yield v1193, v1192; }; - v863 = arith.add v818, v1201 : i32 #[overflow = wrapping]; - v865 = hir.bitcast v863 : u32; - v1203 = arith.constant 4 : u32; - v867 = arith.mod v865, v1203 : u32; - hir.assertz v867 #[code = 250]; - v868 = hir.int_to_ptr v865 : ptr; - hir.store v868, v1202; + v856 = arith.add v811, v1194 : i32 #[overflow = wrapping]; + v858 = hir.bitcast v856 : u32; + v1196 = arith.constant 4 : u32; + v860 = arith.mod v858, v1196 : u32; + hir.assertz v860 #[code = 250]; + v861 = hir.int_to_ptr v858 : ptr; + hir.store v861, v1195; builtin.ret ; }; - private builtin.function @::deallocate(v869: i32, v870: i32, v871: i32) { - ^block104(v869: i32, v870: i32, v871: i32): - v1216 = arith.constant 0 : i32; - v872 = arith.constant 0 : i32; - v873 = arith.eq v871, v872 : i1; - v874 = arith.zext v873 : u32; - v875 = hir.bitcast v874 : i32; - v877 = arith.neq v875, v1216 : i1; - scf.if v877{ + private builtin.function @::deallocate(v862: i32, v863: i32, v864: i32) { + ^block104(v862: i32, v863: i32, v864: i32): + v1209 = arith.constant 0 : i32; + v865 = arith.constant 0 : i32; + v866 = arith.eq v864, v865 : i1; + v867 = arith.zext v866 : u32; + v868 = hir.bitcast v867 : i32; + v870 = arith.neq v868, v1209 : i1; + scf.if v870{ ^block106: scf.yield ; } else { ^block107: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v869, v871, v870) + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v862, v864, v863) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v878: i32, v879: i32, v880: i32) { - ^block108(v878: i32, v879: i32, v880: i32): + private builtin.function @alloc::raw_vec::handle_error(v871: i32, v872: i32, v873: i32) { + ^block108(v871: i32, v872: i32, v873: i32): ub.unreachable ; }; - private builtin.function @core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v881: i32, v882: i32, v883: i32) { - ^block110(v881: i32, v882: i32, v883: i32): + private builtin.function @core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v874: i32, v875: i32, v876: i32) { + ^block110(v874: i32, v875: i32, v876: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v884: i32, v885: i32) -> i32 { - ^block112(v884: i32, v885: i32): - v892 = arith.constant 0 : i32; - v888 = hir.bitcast v885 : u32; - v887 = hir.bitcast v884 : u32; - v889 = arith.gt v887, v888 : i1; - v890 = arith.zext v889 : u32; - v891 = hir.bitcast v890 : i32; - v893 = arith.neq v891, v892 : i1; - v894 = cf.select v893, v884, v885 : i32; - builtin.ret v894; + private builtin.function @core::ptr::alignment::Alignment::max(v877: i32, v878: i32) -> i32 { + ^block112(v877: i32, v878: i32): + v885 = arith.constant 0 : i32; + v881 = hir.bitcast v878 : u32; + v880 = hir.bitcast v877 : u32; + v882 = arith.gt v880, v881 : i1; + v883 = arith.zext v882 : u32; + v884 = hir.bitcast v883 : i32; + v886 = arith.neq v884, v885 : i1; + v887 = cf.select v886, v877, v878 : i32; + builtin.ret v887; }; - private builtin.function @miden::output_note::create(v895: felt, v896: felt, v897: felt, v898: felt, v899: felt, v900: felt, v901: felt, v902: felt) -> felt { - ^block114(v895: felt, v896: felt, v897: felt, v898: felt, v899: felt, v900: felt, v901: felt, v902: felt): - v903 = hir.exec @miden/output_note/create(v895, v896, v897, v898, v899, v900, v901, v902) : felt - builtin.ret v903; + private builtin.function @miden::output_note::create(v888: felt, v889: felt, v890: felt, v891: felt, v892: felt, v893: felt, v894: felt, v895: felt) -> felt { + ^block114(v888: felt, v889: felt, v890: felt, v891: felt, v892: felt, v893: felt, v894: felt, v895: felt): + v896 = hir.exec @miden/output_note/create(v888, v889, v890, v891, v892, v893, v894, v895) : felt + builtin.ret v896; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1259,14 +1254,14 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e62696c2f6372730073722e6d656d2f62696c6474732f6372732f312e372e302d7379732d62696c6474732d6e6564696d; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; - builtin.segment @1048628 = 0x00000021000000270000000a0010002900000025000000250000000a0010002900000021000000970000002800100000000000010000000100000001; + builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v905: felt, v906: felt, v907: felt, v908: felt) { - ^block118(v905: felt, v906: felt, v907: felt, v908: felt): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v905, v906, v907, v908) + public builtin.function @run(v898: felt, v899: felt, v900: felt, v901: felt) { + ^block118(v898: felt, v899: felt, v900: felt, v901: felt): + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v898, v899, v900, v901) 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 36eccff71..e21edb60e 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -16,20 +16,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[10151340310367592649,1643550100843527730,13897610209430550998,3750372866565455699] + push.[3747760794384071571,1766386520481277932,2198275188940187258,538857382178104910] adv.push_mapval push.262144 - push.7 + push.3 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278560 + mem_store.278544 push.0 u32assert - mem_store.278561 + mem_store.278545 end # mod miden:base/transaction-script@1.0.0::basic_wallet_tx_script @@ -58,10 +58,20 @@ end @callconv("C") proc core::slice::index::slice_end_index_len_fail( - i32, i32, i32 ) + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + movdn.2 trace.240 nop exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime @@ -76,7 +86,6 @@ proc as core::ops::index::Index>::index( i32, i32, i32, - i32, i32 ) push.8 @@ -103,9 +112,6 @@ proc as core::ops::index::Index>::index( u32lte neq if.true - movup.5 - swap.1 - drop drop push.4 dup.1 @@ -184,7 +190,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114244 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -192,7 +198,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048688 + push.1048616 u32wrapping_add movup.2 swap.1 @@ -212,7 +218,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114244 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -220,7 +226,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048688 + push.1048616 u32wrapping_add dup.1 swap.2 @@ -304,7 +310,7 @@ end @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -314,7 +320,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop push.80 u32wrapping_sub - push.1114240 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -466,7 +472,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop movup.2 drop - push.1114244 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -491,7 +497,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.1048640 + push.1048600 movup.2 u32wrapping_add swap.2 @@ -608,16 +614,8 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop push.0 else - push.1114244 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.12 - dup.3 + dup.2 add u32assert push.4 @@ -634,7 +632,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.8 - dup.4 + dup.3 add u32assert push.4 @@ -651,7 +649,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.4 - dup.5 + dup.4 add u32assert push.4 @@ -667,7 +665,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + movup.4 push.4 dup.1 swap.1 @@ -681,16 +679,13 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - push.1048656 - movup.5 - u32wrapping_add push.8 push.4 push.20 - dup.8 + dup.7 u32wrapping_add push.8 - dup.9 + dup.8 u32wrapping_add trace.240 nop @@ -806,19 +801,11 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop - push.1114244 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.32 - dup.6 + dup.5 u32wrapping_add push.64 - dup.7 + dup.6 u32wrapping_add trace.240 nop @@ -826,24 +813,20 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.64 - dup.6 + dup.5 u32wrapping_add - movdn.5 - movdn.5 + movdn.4 trace.240 nop exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden_base_sys::bindings::output_note::create trace.252 nop - push.1048672 - movup.2 - u32wrapping_add push.12 push.8 push.20 - dup.5 + dup.4 u32wrapping_add - dup.5 + dup.4 trace.240 nop exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script:: as core::ops::index::Index>::index @@ -1062,7 +1045,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) push.80 movup.2 u32wrapping_add - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1099,7 +1082,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114244 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -1107,7 +1090,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048692 + push.1048620 u32wrapping_add u32divmod.4 swap.1 @@ -1128,7 +1111,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114244 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -1142,7 +1125,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048692 + push.1048620 movup.2 u32wrapping_add u32divmod.4 @@ -1572,7 +1555,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( i32, i32 ) - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1582,7 +1565,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114240 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1673,7 +1656,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1691,7 +1674,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1701,7 +1684,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114240 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -2086,7 +2069,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -2102,7 +2085,7 @@ proc ::allocate( i32, i32 ) - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -2112,7 +2095,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114240 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -2205,7 +2188,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114240 + push.1114176 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index 098ea2c59..f41eb2940 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -29,21 +29,21 @@ (core module (;0;) (type (;0;) (func (param f32 f32 f32 f32 f32))) (type (;1;) (func)) - (type (;2;) (func (param i32 i32 i32))) - (type (;3;) (func (param i32 i32 i32 i32 i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32 i32 i32 i32))) (type (;4;) (func (param i32 i32) (result i32))) - (type (;5;) (func (param f32 f32 f32 f32))) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (type (;7;) (func (result i32))) - (type (;8;) (func (param f32 f32 f32 f32 i32) (result f32))) - (type (;9;) (func (param i32 i32))) + (type (;5;) (func (param i32 i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32))) + (type (;7;) (func (param i32 i32 i32) (result i32))) + (type (;8;) (func (result i32))) + (type (;9;) (func (param f32 f32 f32 f32 i32) (result f32))) (type (;10;) (func (param i64) (result f32))) (type (;11;) (func (param i32) (result f32))) (type (;12;) (func (param f32) (result i64))) (type (;13;) (func (param f32 f32))) (type (;14;) (func (param f32 f32 f32 f32) (result f32))) (type (;15;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) - (type (;16;) (func (param i32 i32 i32 i32))) + (type (;16;) (func (param i32 i32 i32 i32 i32))) (type (;17;) (func (param f32 f32 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) @@ -54,24 +54,25 @@ (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;1;) (type 1)) - (func $core::slice::index::slice_end_index_len_fail (;2;) (type 2) (param i32 i32 i32) + (func $core::slice::index::slice_end_index_len_fail (;2;) (type 2) (param i32 i32) local.get 0 local.get 1 - local.get 2 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add call $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime unreachable ) - (func $ as core::ops::index::Index>::index (;3;) (type 3) (param i32 i32 i32 i32 i32) + (func $ as core::ops::index::Index>::index (;3;) (type 3) (param i32 i32 i32 i32) (local i32) block ;; label = @1 local.get 3 local.get 1 i32.load offset=8 - local.tee 5 + local.tee 4 i32.le_u br_if 0 (;@1;) local.get 3 - local.get 5 local.get 4 call $core::slice::index::slice_end_index_len_fail unreachable @@ -92,17 +93,17 @@ ) (func $__rustc::__rust_alloc (;4;) (type 4) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048688 + i32.const 1048616 i32.add local.get 1 local.get 0 call $::alloc ) - (func $__rustc::__rust_dealloc (;5;) (type 2) (param i32 i32 i32)) + (func $__rustc::__rust_dealloc (;5;) (type 5) (param i32 i32 i32)) (func $__rustc::__rust_alloc_zeroed (;6;) (type 4) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048688 + i32.const 1048616 i32.add local.get 1 local.get 0 @@ -121,7 +122,7 @@ local.get 1 ) (func $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports (;7;) (type 1)) - (func $miden:base/transaction-script@1.0.0#run (;8;) (type 5) (param f32 f32 f32 f32) + (func $miden:base/transaction-script@1.0.0#run (;8;) (type 6) (param f32 f32 f32 f32) (local i32 i64 f32 i32 i32 i32) global.get $__stack_pointer i32.const 80 @@ -194,8 +195,6 @@ local.get 7 i32.eqz br_if 1 (;@1;) - global.get $GOT.data.internal.__memory_base - local.set 7 local.get 9 f32.load offset=12 local.set 0 @@ -216,9 +215,6 @@ i32.add i32.const 4 i32.const 8 - local.get 7 - i32.const 1048656 - i32.add call $ as core::ops::index::Index>::index local.get 4 i32.load offset=12 @@ -243,8 +239,6 @@ local.get 4 local.get 5 i64.store offset=32 - global.get $GOT.data.internal.__memory_base - local.set 9 local.get 4 i32.const 64 i32.add @@ -267,9 +261,6 @@ i32.add i32.const 8 i32.const 12 - local.get 9 - i32.const 1048672 - i32.add call $ as core::ops::index::Index>::index local.get 4 i32.load offset=4 @@ -329,7 +320,7 @@ local.get 4 i32.load offset=72 local.get 9 - i32.const 1048640 + i32.const 1048600 i32.add call $alloc::raw_vec::handle_error end @@ -342,7 +333,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048692 + i32.const 1048620 i32.add i32.load8_u br_if 0 (;@1;) @@ -350,13 +341,13 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048692 + i32.const 1048620 i32.add i32.const 1 i32.store8 end ) - (func $::alloc (;11;) (type 6) (param i32 i32 i32) (result i32) + (func $::alloc (;11;) (type 7) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -428,10 +419,10 @@ end unreachable ) - (func $intrinsics::mem::heap_base (;12;) (type 7) (result i32) + (func $intrinsics::mem::heap_base (;12;) (type 8) (result i32) unreachable ) - (func $miden_base_sys::bindings::output_note::create (;13;) (type 8) (param f32 f32 f32 f32 i32) (result f32) + (func $miden_base_sys::bindings::output_note::create (;13;) (type 9) (param f32 f32 f32 f32 i32) (result f32) local.get 0 local.get 1 local.get 2 @@ -446,7 +437,7 @@ f32.load call $miden::output_note::create ) - (func $>::from (;14;) (type 9) (param i32 i32) + (func $>::from (;14;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -474,7 +465,7 @@ (func $std::mem::pipe_preimage_to_memory (;20;) (type 15) (param f32 i32 f32 f32 f32 f32) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;21;) (type 2) (param i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::deallocate (;21;) (type 5) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -506,7 +497,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;22;) (type 3) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;22;) (type 16) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -618,7 +609,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;23;) (type 2) (param i32 i32 i32) + (func $::allocate (;23;) (type 5) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -647,7 +638,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;24;) (type 16) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;24;) (type 3) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -674,7 +665,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;25;) (type 16) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;25;) (type 3) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -709,7 +700,7 @@ local.get 4 i32.store ) - (func $::deallocate (;26;) (type 2) (param i32 i32 i32) + (func $::deallocate (;26;) (type 5) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -720,10 +711,10 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;27;) (type 2) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;27;) (type 5) (param i32 i32 i32) unreachable ) - (func $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime (;28;) (type 2) (param i32 i32 i32) + (func $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime (;28;) (type 5) (param i32 i32 i32) unreachable ) (func $core::ptr::alignment::Alignment::max (;29;) (type 4) (param i32 i32) (result i32) @@ -737,8 +728,8 @@ (func $miden::output_note::create (;30;) (type 17) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.7.1/src/stdlib/mem.rs\00src/lib.rs\00") - (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00)\00\10\00\0a\00\00\00%\00\00\00%\00\00\00)\00\10\00\0a\00\00\00'\00\00\00!\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "word" (type (;4;))) (alias export 1 "move-asset-to-note" (func (;0;))) diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index 90faf3e3b..bda1e9f8d 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -16,7 +16,7 @@ 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 1048672 : i32; + v10 = arith.constant 1048616 : 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; @@ -32,36 +32,36 @@ builtin.component miden:base/note-script@1.0.0 { 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 1048672 : i32; + v22 = arith.constant 1048616 : 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 - v905 = arith.constant 0 : i32; + v898 = 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, v905 : i1; + v30 = arith.neq v28, v898 : i1; scf.if v30{ ^block16: scf.yield ; } else { ^block17: - v903 = arith.constant 0 : i32; - v904 = arith.constant 0 : i32; - v32 = arith.eq v16, v904 : i1; + v896 = arith.constant 0 : i32; + v897 = arith.constant 0 : i32; + v32 = arith.eq v16, v897 : i1; v33 = arith.zext v32 : u32; v34 = hir.bitcast v33 : i32; - v36 = arith.neq v34, v903 : i1; + v36 = arith.neq v34, v896 : i1; scf.if v36{ ^block114: scf.yield ; } else { ^block18: - v897 = arith.constant 0 : u8; + v890 = 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, v897; + hir.mem_set v41, v39, v890; scf.yield ; }; scf.yield ; @@ -97,38 +97,38 @@ builtin.component miden:base/note-script@1.0.0 { v64 = hir.int_to_ptr v61 : ptr; v65 = hir.load v64 : i32; v66 = hir.cast v65 : u32; - v963 = scf.index_switch v66 : u32 + v956 = scf.index_switch v66 : u32 case 0 { ^block119: - v1007 = arith.constant 1 : u32; - scf.yield v1007; + v1000 = arith.constant 1 : u32; + scf.yield v1000; } case 1 { ^block120: - v1006 = arith.constant 1 : u32; - scf.yield v1006; + v999 = arith.constant 1 : u32; + scf.yield v999; } default { ^block24: v68 = arith.constant 20 : u32; v67 = hir.bitcast v54 : u32; v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v1040 = arith.constant 4 : u32; - v71 = arith.mod v69, v1040 : u32; + v1033 = arith.constant 4 : u32; + v71 = arith.mod v69, v1033 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : i32; - v1039 = arith.constant 4 : u32; + v1032 = arith.constant 4 : u32; v74 = hir.bitcast v73 : u32; - v76 = arith.add v74, v1039 : u32 #[overflow = checked]; - v1038 = arith.constant 4 : u32; - v78 = arith.mod v76, v1038 : u32; + v76 = arith.add v74, v1032 : u32 #[overflow = checked]; + v1031 = arith.constant 4 : u32; + v78 = arith.mod v76, v1031 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; v80 = hir.load v79 : felt; v81 = hir.bitcast v73 : u32; - v1037 = arith.constant 4 : u32; - v83 = arith.mod v81, v1037 : u32; + v1030 = arith.constant 4 : u32; + v83 = arith.mod v81, v1030 : u32; hir.assertz v83 #[code = 250]; v84 = hir.int_to_ptr v81 : ptr; v85 = hir.load v84 : felt; @@ -138,16 +138,16 @@ builtin.component miden:base/note-script@1.0.0 { v89 = arith.constant 12 : u32; v88 = hir.bitcast v54 : u32; v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v1036 = arith.constant 4 : u32; - v92 = arith.mod v90, v1036 : u32; + v1029 = arith.constant 4 : u32; + v92 = arith.mod v90, v1029 : 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]; - v1035 = arith.constant 4 : u32; - v99 = arith.mod v97, v1035 : u32; + v1028 = arith.constant 4 : u32; + v99 = arith.mod v97, v1028 : u32; hir.assertz v99 #[code = 250]; v100 = hir.int_to_ptr v97 : ptr; v101 = hir.load v100 : felt; @@ -158,19 +158,19 @@ builtin.component miden:base/note-script@1.0.0 { v105 = arith.zext v104 : u32; v106 = hir.bitcast v105 : i32; v108 = arith.neq v106, v47 : i1; - v965 = scf.if v108 : u32 { + v958 = scf.if v108 : u32 { ^block118: - v915 = arith.constant 1 : u32; - scf.yield v915; + v908 = arith.constant 1 : u32; + scf.yield v908; } else { ^block25: v109 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v94, v80) : i32 - v1033 = arith.constant 0 : i32; - v1034 = arith.constant 1 : i32; - v111 = arith.neq v109, v1034 : i1; + v1026 = arith.constant 0 : i32; + v1027 = arith.constant 1 : i32; + v111 = arith.neq v109, v1027 : i1; v112 = arith.zext v111 : u32; v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v1033 : i1; + v115 = arith.neq v113, v1026 : i1; scf.if v115{ ^block117: scf.yield ; @@ -182,136 +182,136 @@ builtin.component miden:base/note-script@1.0.0 { v119 = arith.constant 36 : u32; v118 = hir.bitcast v54 : u32; v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v1032 = arith.constant 4 : u32; - v122 = arith.mod v120, v1032 : u32; + v1025 = arith.constant 4 : u32; + v122 = arith.mod v120, v1025 : 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]; - v1031 = arith.constant 4 : u32; - v132 = arith.mod v130, v1031 : u32; + v1024 = arith.constant 4 : u32; + v132 = arith.mod v130, v1024 : 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]; - v1030 = arith.constant 4 : u32; - v139 = arith.mod v137, v1030 : u32; + v1023 = arith.constant 4 : u32; + v139 = arith.mod v137, v1023 : u32; hir.assertz v139 #[code = 250]; v140 = hir.int_to_ptr v137 : ptr; v141 = hir.load v140 : i32; - v1029 = arith.constant 4 : u32; - v127 = arith.shl v124, v1029 : i32; - v983, v984, v985, v986, v987, v988, v989, v990 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block132(v991: i32, v992: i32, v993: i32, v994: i32, v995: i32): - v1027 = arith.constant 0 : i32; - v1028 = arith.constant 0 : i32; - v144 = arith.eq v991, v1028 : i1; + v1022 = arith.constant 4 : u32; + v127 = arith.shl v124, v1022 : i32; + v976, v977, v978, v979, v980, v981, v982, v983 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { + ^block132(v984: i32, v985: i32, v986: i32, v987: i32, v988: i32): + v1020 = arith.constant 0 : i32; + v1021 = arith.constant 0 : i32; + v144 = arith.eq v984, v1021 : i1; v145 = arith.zext v144 : u32; v146 = hir.bitcast v145 : i32; - v148 = arith.neq v146, v1027 : i1; - v976, v977 = scf.if v148 : i32, i32 { + v148 = arith.neq v146, v1020 : i1; + v969, v970 = scf.if v148 : i32, i32 { ^block131: - v916 = ub.poison i32 : i32; - scf.yield v916, v916; + v909 = ub.poison i32 : i32; + scf.yield v909, v909; } else { ^block30: - v150 = hir.bitcast v992 : u32; - v1026 = arith.constant 4 : u32; - v152 = arith.mod v150, v1026 : u32; + v150 = hir.bitcast v985 : u32; + v1019 = arith.constant 4 : u32; + v152 = arith.mod v150, v1019 : u32; hir.assertz v152 #[code = 250]; v153 = hir.int_to_ptr v150 : ptr; v154 = hir.load v153 : felt; - v1025 = arith.constant 4 : u32; - v155 = hir.bitcast v992 : u32; - v157 = arith.add v155, v1025 : u32 #[overflow = checked]; - v1024 = arith.constant 4 : u32; - v159 = arith.mod v157, v1024 : u32; + v1018 = arith.constant 4 : u32; + v155 = hir.bitcast v985 : u32; + v157 = arith.add v155, v1018 : u32 #[overflow = checked]; + v1017 = arith.constant 4 : u32; + v159 = arith.mod v157, v1017 : u32; hir.assertz v159 #[code = 250]; v160 = hir.int_to_ptr v157 : ptr; v161 = hir.load v160 : felt; - v1023 = arith.constant 8 : u32; - v162 = hir.bitcast v992 : u32; - v164 = arith.add v162, v1023 : u32 #[overflow = checked]; - v1022 = arith.constant 4 : u32; - v166 = arith.mod v164, v1022 : u32; + v1016 = arith.constant 8 : u32; + v162 = hir.bitcast v985 : u32; + v164 = arith.add v162, v1016 : u32 #[overflow = checked]; + v1015 = arith.constant 4 : u32; + v166 = arith.mod v164, v1015 : u32; hir.assertz v166 #[code = 250]; v167 = hir.int_to_ptr v164 : ptr; v168 = hir.load v167 : felt; - v1021 = arith.constant 12 : u32; - v169 = hir.bitcast v992 : u32; - v171 = arith.add v169, v1021 : u32 #[overflow = checked]; - v1020 = arith.constant 4 : u32; - v173 = arith.mod v171, v1020 : u32; + v1014 = arith.constant 12 : u32; + v169 = hir.bitcast v985 : u32; + v171 = arith.add v169, v1014 : u32 #[overflow = checked]; + v1013 = arith.constant 4 : u32; + v173 = arith.mod v171, v1013 : 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) - v1019 = arith.constant 16 : i32; - v179 = arith.add v992, v1019 : i32 #[overflow = wrapping]; + v1012 = arith.constant 16 : i32; + v179 = arith.add v985, v1012 : i32 #[overflow = wrapping]; v176 = arith.constant -16 : i32; - v177 = arith.add v991, v176 : i32 #[overflow = wrapping]; + v177 = arith.add v984, v176 : i32 #[overflow = wrapping]; scf.yield v177, v179; }; - v1015 = ub.poison i32 : i32; - v980 = cf.select v148, v1015, v995 : i32; - v1016 = ub.poison i32 : i32; - v979 = cf.select v148, v1016, v994 : i32; - v1017 = ub.poison i32 : i32; - v978 = cf.select v148, v1017, v993 : i32; - v1018 = arith.constant 1 : u32; - v907 = arith.constant 0 : u32; - v982 = cf.select v148, v907, v1018 : u32; - v960 = arith.trunc v982 : i1; - scf.condition v960, v976, v977, v978, v979, v980, v993, v994, v995; + v1008 = ub.poison i32 : i32; + v973 = cf.select v148, v1008, v988 : i32; + v1009 = ub.poison i32 : i32; + v972 = cf.select v148, v1009, v987 : i32; + v1010 = ub.poison i32 : i32; + v971 = cf.select v148, v1010, v986 : i32; + v1011 = arith.constant 1 : u32; + v900 = arith.constant 0 : u32; + v975 = cf.select v148, v900, v1011 : u32; + v953 = arith.trunc v975 : i1; + scf.condition v953, v969, v970, v971, v972, v973, v986, v987, v988; } do { - ^block133(v996: i32, v997: i32, v998: i32, v999: i32, v1000: i32, v1001: i32, v1002: i32, v1003: i32): - scf.yield v996, v997, v998, v999, v1000; + ^block133(v989: i32, v990: i32, v991: i32, v992: i32, v993: i32, v994: i32, v995: i32, v996: i32): + scf.yield v989, v990, v991, v992, v993; }; v183 = arith.constant 44 : u32; - v182 = hir.bitcast v988 : u32; + v182 = hir.bitcast v981 : u32; v184 = arith.add v182, v183 : u32 #[overflow = checked]; - v1014 = arith.constant 4 : u32; - v186 = arith.mod v184, v1014 : u32; + v1007 = arith.constant 4 : u32; + v186 = arith.mod v184, v1007 : u32; hir.assertz v186 #[code = 250]; v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v989; + hir.store v187, v982; v190 = arith.constant 40 : u32; - v189 = hir.bitcast v988 : u32; + v189 = hir.bitcast v981 : u32; v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v1013 = arith.constant 4 : u32; - v193 = arith.mod v191, v1013 : u32; + v1006 = arith.constant 4 : u32; + v193 = arith.mod v191, v1006 : u32; hir.assertz v193 #[code = 250]; v194 = hir.int_to_ptr v191 : ptr; - hir.store v194, v990; - v1012 = arith.constant 16 : i32; + hir.store v194, v983; + v1005 = arith.constant 16 : i32; v195 = arith.constant 40 : i32; - v196 = arith.add v988, v195 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v196, v1012, v1012) + v196 = arith.add v981, v195 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v196, v1005, v1005) v125 = arith.constant 4 : i32; - v1011 = arith.constant 16 : i32; - v200 = arith.add v988, v1011 : i32 #[overflow = wrapping]; + v1004 = arith.constant 16 : i32; + v200 = arith.add v981, v1004 : i32 #[overflow = wrapping]; hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v200, v125, v125) - v1010 = arith.constant 48 : i32; - v204 = arith.add v988, v1010 : i32 #[overflow = wrapping]; + v1003 = arith.constant 48 : i32; + v204 = arith.add v981, v1003 : 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; scf.yield ; }; - v1008 = arith.constant 0 : u32; - v1009 = arith.constant 1 : u32; - v1004 = cf.select v115, v1009, v1008 : u32; - scf.yield v1004; + v1001 = arith.constant 0 : u32; + v1002 = arith.constant 1 : u32; + v997 = cf.select v115, v1002, v1001 : u32; + scf.yield v997; }; - scf.yield v965; + scf.yield v958; }; - v1005 = arith.constant 0 : u32; - v975 = arith.eq v963, v1005 : i1; - cf.cond_br v975 ^block122, ^block23; + v998 = arith.constant 0 : u32; + v968 = arith.eq v956, v998 : i1; + cf.cond_br v968 ^block122, ^block23; ^block23: ub.unreachable ; ^block122: @@ -328,7 +328,7 @@ builtin.component miden:base/note-script@1.0.0 { 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 1048676 : i32; + v211 = arith.constant 1048620 : i32; v212 = arith.add v210, v211 : i32 #[overflow = wrapping]; v213 = hir.bitcast v212 : u32; v214 = hir.int_to_ptr v213 : ptr; @@ -346,12 +346,12 @@ builtin.component miden:base/note-script@1.0.0 { v221 = hir.bitcast v220 : ptr; v222 = hir.load v221 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1042 = arith.constant 1 : u8; - v1044 = arith.constant 1048676 : i32; - v224 = arith.add v222, v1044 : i32 #[overflow = wrapping]; + v1035 = arith.constant 1 : u8; + v1037 = arith.constant 1048620 : i32; + v224 = arith.add v222, v1037 : i32 #[overflow = wrapping]; v228 = hir.bitcast v224 : u32; v229 = hir.int_to_ptr v228 : ptr; - hir.store v229, v1042; + hir.store v229, v1035; scf.yield ; }; builtin.ret ; @@ -361,27 +361,27 @@ builtin.component miden:base/note-script@1.0.0 { ^block37(v230: i32, v231: i32, v232: i32): v235 = arith.constant 16 : i32; v234 = arith.constant 0 : i32; - v1046 = arith.constant 16 : u32; + v1039 = arith.constant 16 : u32; v237 = hir.bitcast v231 : u32; - v239 = arith.gt v237, v1046 : i1; + v239 = arith.gt v237, v1039 : i1; v240 = arith.zext v239 : u32; v241 = hir.bitcast v240 : i32; v243 = arith.neq v241, v234 : i1; v244 = cf.select v243, v231, v235 : i32; - v1086 = arith.constant 0 : i32; + v1079 = 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, v1086 : i1; - v1055, v1056 = scf.if v249 : i32, u32 { + v249 = arith.neq v247, v1079 : i1; + v1048, v1049 = scf.if v249 : i32, u32 { ^block137: - v1047 = arith.constant 0 : u32; - v1051 = ub.poison i32 : i32; - scf.yield v1051, v1047; + v1040 = arith.constant 0 : u32; + v1044 = ub.poison i32 : i32; + scf.yield v1044, v1040; } else { ^block40: v251 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v231, v244) : i32 - v1085 = arith.constant 0 : i32; + v1078 = arith.constant 0 : i32; v250 = arith.constant -2147483648 : i32; v252 = arith.sub v250, v251 : i32 #[overflow = wrapping]; v254 = hir.bitcast v252 : u32; @@ -389,18 +389,18 @@ builtin.component miden:base/note-script@1.0.0 { v255 = arith.gt v253, v254 : i1; v256 = arith.zext v255 : u32; v257 = hir.bitcast v256 : i32; - v259 = arith.neq v257, v1085 : i1; - v1070 = scf.if v259 : i32 { + v259 = arith.neq v257, v1078 : i1; + v1063 = scf.if v259 : i32 { ^block136: - v1084 = ub.poison i32 : i32; - scf.yield v1084; + v1077 = ub.poison i32 : i32; + scf.yield v1077; } else { ^block41: - v1082 = arith.constant 0 : i32; - v265 = arith.sub v1082, v251 : i32 #[overflow = wrapping]; - v1083 = arith.constant -1 : i32; + v1075 = arith.constant 0 : i32; + v265 = arith.sub v1075, v251 : i32 #[overflow = wrapping]; + v1076 = arith.constant -1 : i32; v261 = arith.add v232, v251 : i32 #[overflow = wrapping]; - v263 = arith.add v261, v1083 : i32 #[overflow = wrapping]; + v263 = arith.add v261, v1076 : i32 #[overflow = wrapping]; v266 = arith.band v263, v265 : i32; v267 = hir.bitcast v230 : u32; v268 = arith.constant 4 : u32; @@ -408,8 +408,8 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v269 #[code = 250]; v270 = hir.int_to_ptr v267 : ptr; v271 = hir.load v270 : i32; - v1081 = arith.constant 0 : i32; - v273 = arith.neq v271, v1081 : i1; + v1074 = arith.constant 0 : i32; + v273 = arith.neq v271, v1074 : i1; scf.if v273{ ^block135: scf.yield ; @@ -418,41 +418,41 @@ builtin.component miden:base/note-script@1.0.0 { 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; - v1080 = arith.constant 4 : u32; - v283 = arith.mod v281, v1080 : u32; + v1073 = arith.constant 4 : u32; + v283 = arith.mod v281, v1073 : u32; hir.assertz v283 #[code = 250]; - v1079 = arith.constant 16 : u32; + v1072 = arith.constant 16 : u32; v276 = hir.bitcast v275 : i32; - v279 = arith.shl v276, v1079 : i32; + v279 = arith.shl v276, v1072 : i32; v280 = arith.add v274, v279 : i32 #[overflow = wrapping]; v284 = hir.int_to_ptr v281 : ptr; hir.store v284, v280; scf.yield ; }; v287 = hir.bitcast v230 : u32; - v1078 = arith.constant 4 : u32; - v289 = arith.mod v287, v1078 : u32; + v1071 = arith.constant 4 : u32; + v289 = arith.mod v287, v1071 : u32; hir.assertz v289 #[code = 250]; v290 = hir.int_to_ptr v287 : ptr; v291 = hir.load v290 : i32; - v1076 = arith.constant 0 : i32; - v1077 = arith.constant -1 : i32; - v293 = arith.bxor v291, v1077 : i32; + v1069 = arith.constant 0 : i32; + v1070 = arith.constant -1 : i32; + v293 = arith.bxor v291, v1070 : 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, v1076 : i1; - v1069 = scf.if v300 : i32 { + v300 = arith.neq v298, v1069 : i1; + v1062 = scf.if v300 : i32 { ^block44: - v1075 = arith.constant 0 : i32; - scf.yield v1075; + v1068 = arith.constant 0 : i32; + scf.yield v1068; } else { ^block45: v302 = hir.bitcast v230 : u32; - v1074 = arith.constant 4 : u32; - v304 = arith.mod v302, v1074 : u32; + v1067 = arith.constant 4 : u32; + v304 = arith.mod v302, v1067 : u32; hir.assertz v304 #[code = 250]; v301 = arith.add v291, v266 : i32 #[overflow = wrapping]; v305 = hir.int_to_ptr v302 : ptr; @@ -460,20 +460,20 @@ builtin.component miden:base/note-script@1.0.0 { v307 = arith.add v291, v251 : i32 #[overflow = wrapping]; scf.yield v307; }; - scf.yield v1069; + scf.yield v1062; }; - v1052 = arith.constant 1 : u32; - v1073 = arith.constant 0 : u32; - v1071 = cf.select v259, v1073, v1052 : u32; - scf.yield v1070, v1071; + v1045 = arith.constant 1 : u32; + v1066 = arith.constant 0 : u32; + v1064 = cf.select v259, v1066, v1045 : u32; + scf.yield v1063, v1064; }; - v1072 = arith.constant 0 : u32; - v1068 = arith.eq v1056, v1072 : i1; - cf.cond_br v1068 ^block39, ^block139(v1055); + v1065 = arith.constant 0 : u32; + v1061 = arith.eq v1049, v1065 : i1; + cf.cond_br v1061 ^block39, ^block139(v1048); ^block39: ub.unreachable ; - ^block139(v1048: i32): - builtin.ret v1048; + ^block139(v1041: i32): + builtin.ret v1041; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -482,797 +482,792 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v310; }; - private builtin.function @alloc::vec::Vec::with_capacity(v312: i32, v313: i32) { - ^block50(v312: i32, v313: i32): - v316 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v317 = hir.bitcast v316 : ptr; - v318 = hir.load v317 : i32; - v319 = arith.constant 16 : i32; - v320 = arith.sub v318, v319 : i32 #[overflow = wrapping]; - v321 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v322 = hir.bitcast v321 : ptr; - hir.store v322, v320; - v1091 = arith.constant 16 : i32; - v323 = arith.constant 8 : i32; - v324 = arith.add v320, v323 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v324, v1091, v1091, v313) - v328 = arith.constant 8 : u32; - v327 = hir.bitcast v320 : u32; - v329 = arith.add v327, v328 : u32 #[overflow = checked]; - v1090 = arith.constant 8 : u32; - v331 = arith.mod v329, v1090 : u32; - hir.assertz v331 #[code = 250]; - v332 = hir.int_to_ptr v329 : ptr; - v333 = hir.load v332 : i64; - v1089 = arith.constant 8 : u32; - v335 = hir.bitcast v312 : u32; - v337 = arith.add v335, v1089 : u32 #[overflow = checked]; - v338 = arith.constant 4 : u32; - v339 = arith.mod v337, v338 : u32; - hir.assertz v339 #[code = 250]; - v314 = arith.constant 0 : i32; - v340 = hir.int_to_ptr v337 : ptr; - hir.store v340, v314; - v341 = hir.bitcast v312 : u32; - v1088 = arith.constant 4 : u32; - v343 = arith.mod v341, v1088 : u32; - hir.assertz v343 #[code = 250]; - v344 = hir.int_to_ptr v341 : ptr; - hir.store v344, v333; - v1087 = arith.constant 16 : i32; - v346 = arith.add v320, v1087 : i32 #[overflow = wrapping]; - v347 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v348 = hir.bitcast v347 : ptr; - hir.store v348, v346; + private builtin.function @alloc::vec::Vec::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; + v1084 = 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/alloc::raw_vec::RawVecInner::with_capacity_in(v323, v1084, v1084) + v327 = arith.constant 8 : u32; + v326 = hir.bitcast v319 : u32; + v328 = arith.add v326, v327 : u32 #[overflow = checked]; + v1083 = arith.constant 8 : u32; + v330 = arith.mod v328, v1083 : u32; + hir.assertz v330 #[code = 250]; + v331 = hir.int_to_ptr v328 : ptr; + v332 = hir.load v331 : i64; + v1082 = arith.constant 8 : u32; + v334 = hir.bitcast v312 : u32; + v336 = arith.add v334, v1082 : 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; + v1081 = arith.constant 4 : u32; + v342 = arith.mod v340, v1081 : u32; + hir.assertz v342 #[code = 250]; + v343 = hir.int_to_ptr v340 : ptr; + hir.store v343, v332; + v1080 = arith.constant 16 : i32; + v345 = arith.add v319, v1080 : 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 ; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v349: i32, v350: i32, v351: i32, v352: i32) { - ^block52(v349: i32, v350: i32, v351: i32, v352: i32): - v354 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v355 = hir.bitcast v354 : ptr; - v356 = hir.load v355 : i32; - v357 = arith.constant 16 : i32; - v358 = arith.sub v356, v357 : i32 #[overflow = wrapping]; - v359 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v360 = hir.bitcast v359 : ptr; - hir.store v360, v358; - v353 = arith.constant 0 : i32; - v363 = arith.constant 256 : i32; - v361 = arith.constant 4 : i32; - v362 = arith.add v358, v361 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v362, v363, v353, v350, v351) - v366 = arith.constant 8 : u32; - v365 = hir.bitcast v358 : u32; - v367 = arith.add v365, v366 : u32 #[overflow = checked]; - v368 = arith.constant 4 : u32; - v369 = arith.mod v367, v368 : u32; - hir.assertz v369 #[code = 250]; - v370 = hir.int_to_ptr v367 : ptr; - v371 = hir.load v370 : i32; - v1102 = arith.constant 4 : u32; - v372 = hir.bitcast v358 : u32; - v374 = arith.add v372, v1102 : u32 #[overflow = checked]; - v1101 = arith.constant 4 : u32; - v376 = arith.mod v374, v1101 : u32; - hir.assertz v376 #[code = 250]; - v377 = hir.int_to_ptr v374 : ptr; - v378 = hir.load v377 : i32; - v1100 = arith.constant 0 : i32; - v379 = arith.constant 1 : i32; - v380 = arith.neq v378, v379 : i1; - v381 = arith.zext v380 : u32; - v382 = hir.bitcast v381 : i32; - v384 = arith.neq v382, v1100 : i1; - cf.cond_br v384 ^block54, ^block55; + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v348: i32, v349: i32, v350: i32) { + ^block52(v348: i32, v349: i32, v350: i32): + 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]; + 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/alloc::raw_vec::RawVecInner::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; + v1095 = arith.constant 4 : u32; + v370 = hir.bitcast v356 : u32; + v372 = arith.add v370, v1095 : u32 #[overflow = checked]; + v1094 = arith.constant 4 : u32; + v374 = arith.mod v372, v1094 : u32; + hir.assertz v374 #[code = 250]; + v375 = hir.int_to_ptr v372 : ptr; + v376 = hir.load v375 : i32; + v1093 = 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, v1093 : i1; + cf.cond_br v382 ^block54, ^block55; ^block54: - v393 = arith.constant 12 : u32; - v392 = hir.bitcast v358 : u32; - v394 = arith.add v392, v393 : u32 #[overflow = checked]; - v1099 = arith.constant 4 : u32; - v396 = arith.mod v394, v1099 : u32; - hir.assertz v396 #[code = 250]; - v397 = hir.int_to_ptr v394 : ptr; - v398 = hir.load v397 : i32; - v1098 = arith.constant 4 : u32; - v399 = hir.bitcast v349 : u32; - v401 = arith.add v399, v1098 : u32 #[overflow = checked]; - v1097 = arith.constant 4 : u32; - v403 = arith.mod v401, v1097 : u32; - hir.assertz v403 #[code = 250]; - v404 = hir.int_to_ptr v401 : ptr; - hir.store v404, v398; - v405 = hir.bitcast v349 : u32; - v1096 = arith.constant 4 : u32; - v407 = arith.mod v405, v1096 : u32; - hir.assertz v407 #[code = 250]; - v408 = hir.int_to_ptr v405 : ptr; - hir.store v408, v371; - v1095 = arith.constant 16 : i32; - v410 = arith.add v358, v1095 : i32 #[overflow = wrapping]; - v411 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v412 = hir.bitcast v411 : ptr; - hir.store v412, v410; + v396 = arith.constant 12 : u32; + v395 = hir.bitcast v356 : u32; + v397 = arith.add v395, v396 : u32 #[overflow = checked]; + v1092 = arith.constant 4 : u32; + v399 = arith.mod v397, v1092 : u32; + hir.assertz v399 #[code = 250]; + v400 = hir.int_to_ptr v397 : ptr; + v401 = hir.load v400 : i32; + v1091 = arith.constant 4 : u32; + v402 = hir.bitcast v348 : u32; + v404 = arith.add v402, v1091 : u32 #[overflow = checked]; + v1090 = arith.constant 4 : u32; + v406 = arith.mod v404, v1090 : u32; + hir.assertz v406 #[code = 250]; + v407 = hir.int_to_ptr v404 : ptr; + hir.store v407, v401; + v408 = hir.bitcast v348 : u32; + v1089 = arith.constant 4 : u32; + v410 = arith.mod v408, v1089 : u32; + hir.assertz v410 #[code = 250]; + v411 = hir.int_to_ptr v408 : ptr; + hir.store v411, v369; + v1088 = arith.constant 16 : i32; + v413 = arith.add v356, v1088 : i32 #[overflow = wrapping]; + v414 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v415 = hir.bitcast v414 : ptr; + hir.store v415, v413; builtin.ret ; ^block55: - v1094 = arith.constant 12 : u32; - v385 = hir.bitcast v358 : u32; - v387 = arith.add v385, v1094 : u32 #[overflow = checked]; - v1093 = arith.constant 4 : u32; - v389 = arith.mod v387, v1093 : u32; - hir.assertz v389 #[code = 250]; - v390 = hir.int_to_ptr v387 : ptr; - v391 = hir.load v390 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v371, v391, v352) + v383 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v384 = hir.bitcast v383 : ptr; + v385 = hir.load v384 : i32; + v1087 = arith.constant 12 : u32; + v386 = hir.bitcast v356 : u32; + v388 = arith.add v386, v1087 : u32 #[overflow = checked]; + v1086 = arith.constant 4 : u32; + v390 = arith.mod v388, v1086 : u32; + hir.assertz v390 #[code = 250]; + v391 = hir.int_to_ptr v388 : ptr; + v392 = hir.load v391 : i32; + v393 = arith.constant 1048600 : i32; + v394 = arith.add v385, v393 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v369, v392, v394) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_account::get_id(v413: i32) { - ^block56(v413: i32): - v415 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v416 = hir.bitcast v415 : ptr; - v417 = hir.load v416 : i32; - v418 = arith.constant 16 : i32; - v419 = arith.sub v417, v418 : i32 #[overflow = wrapping]; - v420 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v421 = hir.bitcast v420 : ptr; - hir.store v421, v419; - v422 = arith.constant 8 : i32; - v423 = arith.add v419, v422 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v423) - v425 = arith.constant 8 : u32; - v424 = hir.bitcast v419 : u32; - v426 = arith.add v424, v425 : u32 #[overflow = checked]; - v427 = arith.constant 4 : u32; - v428 = arith.mod v426, v427 : u32; - hir.assertz v428 #[code = 250]; - v429 = hir.int_to_ptr v426 : ptr; - v430 = hir.load v429 : i64; - v431 = hir.bitcast v413 : u32; + private builtin.function @miden_base_sys::bindings::active_account::get_id(v416: i32) { + ^block56(v416: i32): + v418 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v419 = hir.bitcast v418 : ptr; + v420 = hir.load v419 : i32; + v421 = arith.constant 16 : i32; + v422 = arith.sub v420, v421 : i32 #[overflow = wrapping]; + v423 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v424 = hir.bitcast v423 : ptr; + hir.store v424, v422; + v425 = arith.constant 8 : i32; + v426 = arith.add v422, v425 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v426) + v428 = arith.constant 8 : u32; + v427 = hir.bitcast v422 : 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 : i64; + v434 = hir.bitcast v416 : u32; + v1097 = arith.constant 8 : u32; + v436 = arith.mod v434, v1097 : u32; + hir.assertz v436 #[code = 250]; + v437 = hir.int_to_ptr v434 : ptr; + hir.store v437, v433; + v1096 = arith.constant 16 : i32; + v439 = arith.add v422, v1096 : i32 #[overflow = wrapping]; + v440 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v441 = hir.bitcast v440 : ptr; + hir.store v441, v439; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v442: i32) { + ^block58(v442: i32): + v444 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v445 = hir.bitcast v444 : ptr; + v446 = hir.load v445 : i32; + v447 = arith.constant 16 : i32; + v448 = arith.sub v446, v447 : i32 #[overflow = wrapping]; + v449 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v450 = hir.bitcast v449 : ptr; + hir.store v450, v448; + v453 = arith.constant 4 : i32; + v451 = arith.constant 8 : i32; + v452 = arith.add v448, v451 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v452, v453, v453) + v456 = arith.constant 8 : u32; + v455 = hir.bitcast v448 : u32; + v457 = arith.add v455, v456 : u32 #[overflow = checked]; + v458 = arith.constant 4 : u32; + v459 = arith.mod v457, v458 : u32; + hir.assertz v459 #[code = 250]; + v460 = hir.int_to_ptr v457 : ptr; + v461 = hir.load v460 : i32; + v463 = arith.constant 12 : u32; + v462 = hir.bitcast v448 : u32; + v464 = arith.add v462, v463 : u32 #[overflow = checked]; + v1105 = arith.constant 4 : u32; + v466 = arith.mod v464, v1105 : u32; + hir.assertz v466 #[code = 250]; + v467 = hir.int_to_ptr v464 : ptr; + v468 = hir.load v467 : i32; + v1098 = arith.constant 2 : u32; + v470 = hir.bitcast v468 : u32; + v472 = arith.shr v470, v1098 : u32; + v473 = hir.bitcast v472 : i32; + v474 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v473) : i32 v1104 = arith.constant 8 : u32; - v433 = arith.mod v431, v1104 : u32; - hir.assertz v433 #[code = 250]; - v434 = hir.int_to_ptr v431 : ptr; - hir.store v434, v430; - v1103 = arith.constant 16 : i32; - v436 = arith.add v419, v1103 : i32 #[overflow = wrapping]; - v437 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v438 = hir.bitcast v437 : ptr; - hir.store v438, v436; + v475 = hir.bitcast v442 : u32; + v477 = arith.add v475, v1104 : u32 #[overflow = checked]; + v1103 = arith.constant 4 : u32; + v479 = arith.mod v477, v1103 : u32; + hir.assertz v479 #[code = 250]; + v480 = hir.int_to_ptr v477 : ptr; + hir.store v480, v474; + v1102 = arith.constant 4 : u32; + v481 = hir.bitcast v442 : u32; + v483 = arith.add v481, v1102 : u32 #[overflow = checked]; + v1101 = arith.constant 4 : u32; + v485 = arith.mod v483, v1101 : u32; + hir.assertz v485 #[code = 250]; + v486 = hir.int_to_ptr v483 : ptr; + hir.store v486, v468; + v487 = hir.bitcast v442 : u32; + v1100 = arith.constant 4 : u32; + v489 = arith.mod v487, v1100 : u32; + hir.assertz v489 #[code = 250]; + v490 = hir.int_to_ptr v487 : ptr; + hir.store v490, v461; + v1099 = arith.constant 16 : i32; + v492 = arith.add v448, v1099 : i32 #[overflow = wrapping]; + v493 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v494 = hir.bitcast v493 : ptr; + hir.store v494, v492; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v439: i32) { - ^block58(v439: i32): - v441 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v442 = hir.bitcast v441 : ptr; - v443 = hir.load v442 : i32; - v444 = arith.constant 16 : i32; - v445 = arith.sub v443, v444 : i32 #[overflow = wrapping]; - v446 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v447 = hir.bitcast v446 : ptr; - hir.store v447, v445; - v452 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v453 = hir.bitcast v452 : ptr; - v454 = hir.load v453 : i32; - v455 = arith.constant 1048640 : i32; - v456 = arith.add v454, v455 : i32 #[overflow = wrapping]; - v450 = arith.constant 4 : i32; - v448 = arith.constant 8 : i32; - v449 = arith.add v445, v448 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v449, v450, v450, v456) - v458 = arith.constant 8 : u32; - v457 = hir.bitcast v445 : u32; - v459 = arith.add v457, v458 : u32 #[overflow = checked]; - v460 = arith.constant 4 : u32; - v461 = arith.mod v459, v460 : u32; - hir.assertz v461 #[code = 250]; - v462 = hir.int_to_ptr v459 : ptr; - v463 = hir.load v462 : i32; - v465 = arith.constant 12 : u32; - v464 = hir.bitcast v445 : u32; - v466 = arith.add v464, v465 : u32 #[overflow = checked]; - v1112 = arith.constant 4 : u32; - v468 = arith.mod v466, v1112 : u32; - hir.assertz v468 #[code = 250]; - v469 = hir.int_to_ptr v466 : ptr; - v470 = hir.load v469 : i32; - v1105 = arith.constant 2 : u32; - v472 = hir.bitcast v470 : u32; - v474 = arith.shr v472, v1105 : u32; - v475 = hir.bitcast v474 : i32; - v476 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v475) : i32 - v1111 = arith.constant 8 : u32; - v477 = hir.bitcast v439 : u32; - v479 = arith.add v477, v1111 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v495: i32) { + ^block60(v495: i32): + v497 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v498 = hir.bitcast v497 : ptr; + v499 = hir.load v498 : i32; + v500 = arith.constant 16 : i32; + v501 = arith.sub v499, v500 : i32 #[overflow = wrapping]; + v502 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v503 = hir.bitcast v502 : ptr; + hir.store v503, v501; + v504 = arith.constant 4 : i32; + v505 = arith.add v501, v504 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v505) + v509 = arith.constant 8 : u32; + v508 = hir.bitcast v501 : u32; + v510 = arith.add v508, v509 : u32 #[overflow = checked]; + v511 = arith.constant 4 : u32; + v512 = arith.mod v510, v511 : u32; + hir.assertz v512 #[code = 250]; + v513 = hir.int_to_ptr v510 : ptr; + v514 = hir.load v513 : i32; + v1106 = arith.constant 2 : u32; + v516 = hir.bitcast v514 : u32; + v518 = arith.shr v516, v1106 : u32; + v519 = hir.bitcast v518 : i32; + v520 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v519) : i32 + v506 = arith.constant 8 : i32; + v507 = arith.add v495, v506 : i32 #[overflow = wrapping]; + v521 = hir.bitcast v507 : u32; + v1111 = arith.constant 4 : u32; + v523 = arith.mod v521, v1111 : u32; + hir.assertz v523 #[code = 250]; + v524 = hir.int_to_ptr v521 : ptr; + hir.store v524, v520; v1110 = arith.constant 4 : u32; - v481 = arith.mod v479, v1110 : u32; - hir.assertz v481 #[code = 250]; - v482 = hir.int_to_ptr v479 : ptr; - hir.store v482, v476; + v525 = hir.bitcast v501 : u32; + v527 = arith.add v525, v1110 : u32 #[overflow = checked]; v1109 = arith.constant 4 : u32; - v483 = hir.bitcast v439 : u32; - v485 = arith.add v483, v1109 : u32 #[overflow = checked]; + v529 = arith.mod v527, v1109 : u32; + hir.assertz v529 #[code = 250]; + v530 = hir.int_to_ptr v527 : ptr; + v531 = hir.load v530 : i64; + v532 = hir.bitcast v495 : u32; v1108 = arith.constant 4 : u32; - v487 = arith.mod v485, v1108 : u32; - hir.assertz v487 #[code = 250]; - v488 = hir.int_to_ptr v485 : ptr; - hir.store v488, v470; - v489 = hir.bitcast v439 : u32; - v1107 = arith.constant 4 : u32; - v491 = arith.mod v489, v1107 : u32; - hir.assertz v491 #[code = 250]; - v492 = hir.int_to_ptr v489 : ptr; - hir.store v492, v463; - v1106 = arith.constant 16 : i32; - v494 = arith.add v445, v1106 : i32 #[overflow = wrapping]; - v495 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v496 = hir.bitcast v495 : ptr; - hir.store v496, v494; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::active_note::get_assets(v497: i32) { - ^block60(v497: i32): - v499 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v500 = hir.bitcast v499 : ptr; - v501 = hir.load v500 : i32; - v502 = arith.constant 16 : i32; - v503 = arith.sub v501, v502 : i32 #[overflow = wrapping]; - v504 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v505 = hir.bitcast v504 : ptr; - hir.store v505, v503; - v508 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v509 = hir.bitcast v508 : ptr; - v510 = hir.load v509 : i32; - v511 = arith.constant 1048656 : i32; - v512 = arith.add v510, v511 : i32 #[overflow = wrapping]; - v506 = arith.constant 4 : i32; - v507 = arith.add v503, v506 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v507, v512) - v516 = arith.constant 8 : u32; - v515 = hir.bitcast v503 : 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; - v1113 = arith.constant 2 : u32; - v523 = hir.bitcast v521 : u32; - v525 = arith.shr v523, v1113 : u32; - v526 = hir.bitcast v525 : i32; - v527 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v526) : i32 - v513 = arith.constant 8 : i32; - v514 = arith.add v497, v513 : i32 #[overflow = wrapping]; - v528 = hir.bitcast v514 : u32; - v1118 = arith.constant 4 : u32; - v530 = arith.mod v528, v1118 : u32; - hir.assertz v530 #[code = 250]; - v531 = hir.int_to_ptr v528 : ptr; - hir.store v531, v527; - v1117 = arith.constant 4 : u32; - v532 = hir.bitcast v503 : u32; - v534 = arith.add v532, v1117 : u32 #[overflow = checked]; - v1116 = arith.constant 4 : u32; - v536 = arith.mod v534, v1116 : u32; - hir.assertz v536 #[code = 250]; - v537 = hir.int_to_ptr v534 : ptr; - v538 = hir.load v537 : i64; - v539 = hir.bitcast v497 : u32; - v1115 = arith.constant 4 : u32; - v541 = arith.mod v539, v1115 : u32; - hir.assertz v541 #[code = 250]; - v542 = hir.int_to_ptr v539 : ptr; - hir.store v542, v538; - v1114 = arith.constant 16 : i32; - v544 = arith.add v503, v1114 : i32 #[overflow = wrapping]; - v545 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v546 = hir.bitcast v545 : ptr; - hir.store v546, v544; + v534 = arith.mod v532, v1108 : u32; + hir.assertz v534 #[code = 250]; + v535 = hir.int_to_ptr v532 : ptr; + hir.store v535, v531; + v1107 = arith.constant 16 : i32; + v537 = arith.add v501, v1107 : i32 #[overflow = wrapping]; + v538 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v539 = hir.bitcast v538 : ptr; + hir.store v539, v537; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v547: felt, v548: felt) -> i32 { - ^block62(v547: felt, v548: felt): - v549 = arith.eq v547, v548 : i1; - v550 = hir.cast v549 : i32; - builtin.ret v550; + private builtin.function @intrinsics::felt::eq(v540: felt, v541: felt) -> i32 { + ^block62(v540: felt, v541: felt): + v542 = arith.eq v540, v541 : i1; + v543 = hir.cast v542 : i32; + builtin.ret v543; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v552: i32, v553: i32, v554: i32) { - ^block64(v552: i32, v553: i32, v554: i32): - v556 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v557 = hir.bitcast v556 : ptr; - v558 = hir.load v557 : i32; - v559 = arith.constant 16 : i32; - v560 = arith.sub v558, v559 : i32 #[overflow = wrapping]; - v561 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v562 = hir.bitcast v561 : ptr; - hir.store v562, v560; - v563 = arith.constant 4 : i32; - v564 = arith.add v560, v563 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v564, v552, v553, v554) - v566 = arith.constant 8 : u32; - v565 = hir.bitcast v560 : u32; - v567 = arith.add v565, v566 : u32 #[overflow = checked]; - v568 = arith.constant 4 : u32; - v569 = arith.mod v567, v568 : u32; - hir.assertz v569 #[code = 250]; - v570 = hir.int_to_ptr v567 : ptr; - v571 = hir.load v570 : i32; - v1125 = arith.constant 0 : i32; - v555 = arith.constant 0 : i32; - v573 = arith.eq v571, v555 : i1; - v574 = arith.zext v573 : u32; - v575 = hir.bitcast v574 : i32; - v577 = arith.neq v575, v1125 : i1; - scf.if v577{ + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v545: i32, v546: i32, v547: i32) { + ^block64(v545: i32, v546: i32, v547: i32): + v549 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v550 = hir.bitcast v549 : ptr; + v551 = hir.load v550 : i32; + v552 = arith.constant 16 : i32; + v553 = arith.sub v551, v552 : i32 #[overflow = wrapping]; + v554 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v555 = hir.bitcast v554 : ptr; + hir.store v555, v553; + v556 = arith.constant 4 : i32; + v557 = arith.add v553, v556 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v557, v545, v546, v547) + v559 = arith.constant 8 : u32; + v558 = hir.bitcast v553 : u32; + v560 = arith.add v558, v559 : u32 #[overflow = checked]; + v561 = arith.constant 4 : u32; + v562 = arith.mod v560, v561 : u32; + hir.assertz v562 #[code = 250]; + v563 = hir.int_to_ptr v560 : ptr; + v564 = hir.load v563 : i32; + v1118 = arith.constant 0 : i32; + v548 = arith.constant 0 : i32; + v566 = arith.eq v564, v548 : i1; + v567 = arith.zext v566 : u32; + v568 = hir.bitcast v567 : i32; + v570 = arith.neq v568, v1118 : i1; + scf.if v570{ ^block145: scf.yield ; } else { ^block67: - v1124 = arith.constant 4 : u32; - v578 = hir.bitcast v560 : u32; - v580 = arith.add v578, v1124 : u32 #[overflow = checked]; - v1123 = arith.constant 4 : u32; - v582 = arith.mod v580, v1123 : u32; + v1117 = arith.constant 4 : u32; + v571 = hir.bitcast v553 : u32; + v573 = arith.add v571, v1117 : u32 #[overflow = checked]; + v1116 = arith.constant 4 : u32; + v575 = arith.mod v573, v1116 : u32; + hir.assertz v575 #[code = 250]; + v576 = hir.int_to_ptr v573 : ptr; + v577 = hir.load v576 : i32; + v579 = arith.constant 12 : u32; + v578 = hir.bitcast v553 : u32; + v580 = arith.add v578, v579 : u32 #[overflow = checked]; + v1115 = arith.constant 4 : u32; + v582 = arith.mod v580, v1115 : u32; hir.assertz v582 #[code = 250]; v583 = hir.int_to_ptr v580 : ptr; v584 = hir.load v583 : i32; - v586 = arith.constant 12 : u32; - v585 = hir.bitcast v560 : u32; - v587 = arith.add v585, v586 : u32 #[overflow = checked]; - v1122 = arith.constant 4 : u32; - v589 = arith.mod v587, v1122 : u32; - hir.assertz v589 #[code = 250]; - v590 = hir.int_to_ptr v587 : ptr; - v591 = hir.load v590 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v584, v571, v591) + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v577, v564, v584) scf.yield ; }; - v1121 = arith.constant 16 : i32; - v594 = arith.add v560, v1121 : i32 #[overflow = wrapping]; - v595 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v596 = hir.bitcast v595 : ptr; - hir.store v596, v594; + v1114 = arith.constant 16 : i32; + v587 = arith.add v553, v1114 : i32 #[overflow = wrapping]; + v588 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v589 = hir.bitcast v588 : ptr; + hir.store v589, v587; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v597: i32, v598: i32, v599: i32, v600: i32, v601: i32) { - ^block68(v597: i32, v598: i32, v599: i32, v600: i32, v601: i32): - v604 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v605 = hir.bitcast v604 : ptr; - v606 = hir.load v605 : i32; - v607 = arith.constant 16 : i32; - v608 = arith.sub v606, v607 : i32 #[overflow = wrapping]; - v609 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v610 = hir.bitcast v609 : ptr; - hir.store v610, v608; - v620 = hir.bitcast v598 : u32; - v621 = arith.zext v620 : u64; - v622 = hir.bitcast v621 : i64; - v602 = arith.constant 0 : i32; - v615 = arith.sub v602, v600 : i32 #[overflow = wrapping]; - v612 = arith.constant -1 : i32; - v611 = arith.add v600, v601 : i32 #[overflow = wrapping]; - v613 = arith.add v611, v612 : i32 #[overflow = wrapping]; - v616 = arith.band v613, v615 : i32; - v617 = hir.bitcast v616 : u32; - v618 = arith.zext v617 : u64; - v619 = hir.bitcast v618 : i64; - v623 = arith.mul v619, v622 : i64 #[overflow = wrapping]; - v1229 = arith.constant 0 : i32; - v624 = arith.constant 32 : i64; - v626 = hir.cast v624 : u32; - v625 = hir.bitcast v623 : u64; - v627 = arith.shr v625, v626 : u64; - v628 = hir.bitcast v627 : i64; - v629 = arith.trunc v628 : i32; - v631 = arith.neq v629, v1229 : i1; - v1141, v1142, v1143, v1144, v1145, v1146 = scf.if v631 : i32, i32, i32, i32, i32, u32 { + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32) { + ^block68(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32): + v597 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v598 = hir.bitcast v597 : ptr; + v599 = hir.load v598 : i32; + v600 = arith.constant 16 : i32; + v601 = arith.sub v599, v600 : i32 #[overflow = wrapping]; + v602 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v603 = hir.bitcast v602 : ptr; + hir.store v603, v601; + v613 = hir.bitcast v591 : u32; + v614 = arith.zext v613 : u64; + v615 = hir.bitcast v614 : i64; + v595 = arith.constant 0 : i32; + v608 = arith.sub v595, v593 : i32 #[overflow = wrapping]; + v605 = arith.constant -1 : i32; + v604 = arith.add v593, v594 : i32 #[overflow = wrapping]; + v606 = arith.add v604, v605 : i32 #[overflow = wrapping]; + v609 = arith.band v606, v608 : i32; + v610 = hir.bitcast v609 : u32; + v611 = arith.zext v610 : u64; + v612 = hir.bitcast v611 : i64; + v616 = arith.mul v612, v615 : i64 #[overflow = wrapping]; + v1222 = arith.constant 0 : i32; + v617 = arith.constant 32 : i64; + v619 = hir.cast v617 : u32; + v618 = hir.bitcast v616 : u64; + v620 = arith.shr v618, v619 : u64; + v621 = hir.bitcast v620 : i64; + v622 = arith.trunc v621 : i32; + v624 = arith.neq v622, v1222 : i1; + v1134, v1135, v1136, v1137, v1138, v1139 = scf.if v624 : i32, i32, i32, i32, i32, u32 { ^block147: - v1126 = arith.constant 0 : u32; - v1133 = ub.poison i32 : i32; - scf.yield v597, v608, v1133, v1133, v1133, v1126; + v1119 = arith.constant 0 : u32; + v1126 = ub.poison i32 : i32; + scf.yield v590, v601, v1126, v1126, v1126, v1119; } else { ^block73: - v632 = arith.trunc v623 : i32; - v1228 = arith.constant 0 : i32; - v633 = arith.constant -2147483648 : i32; - v634 = arith.sub v633, v600 : i32 #[overflow = wrapping]; - v636 = hir.bitcast v634 : u32; - v635 = hir.bitcast v632 : u32; - v637 = arith.lte v635, v636 : i1; - v638 = arith.zext v637 : u32; - v639 = hir.bitcast v638 : i32; - v641 = arith.neq v639, v1228 : i1; - v1189 = scf.if v641 : i32 { + v625 = arith.trunc v616 : i32; + v1221 = arith.constant 0 : i32; + v626 = arith.constant -2147483648 : i32; + v627 = arith.sub v626, v593 : i32 #[overflow = wrapping]; + v629 = hir.bitcast v627 : u32; + v628 = hir.bitcast v625 : u32; + v630 = arith.lte v628, v629 : i1; + v631 = arith.zext v630 : u32; + v632 = hir.bitcast v631 : i32; + v634 = arith.neq v632, v1221 : i1; + v1182 = scf.if v634 : i32 { ^block71: - v1227 = arith.constant 0 : i32; - v652 = arith.neq v632, v1227 : i1; - v1188 = scf.if v652 : i32 { + v1220 = arith.constant 0 : i32; + v645 = arith.neq v625, v1220 : i1; + v1181 = scf.if v645 : i32 { ^block75: - v1226 = arith.constant 0 : i32; - v668 = arith.neq v599, v1226 : i1; - v1187 = scf.if v668 : i32 { + v1219 = arith.constant 0 : i32; + v661 = arith.neq v592, v1219 : i1; + v1180 = scf.if v661 : i32 { ^block78: - v650 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v608, v600, v632, v650) - v679 = hir.bitcast v608 : u32; - v724 = arith.constant 4 : u32; - v681 = arith.mod v679, v724 : u32; - hir.assertz v681 #[code = 250]; - v682 = hir.int_to_ptr v679 : ptr; - v683 = hir.load v682 : i32; - scf.yield v683; + v643 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v601, v593, v625, v643) + v672 = hir.bitcast v601 : u32; + v717 = arith.constant 4 : u32; + v674 = arith.mod v672, v717 : u32; + hir.assertz v674 #[code = 250]; + v675 = hir.int_to_ptr v672 : ptr; + v676 = hir.load v675 : i32; + scf.yield v676; } else { ^block79: - v669 = arith.constant 8 : i32; - v670 = arith.add v608, v669 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v670, v600, v632) - v654 = arith.constant 8 : u32; - v671 = hir.bitcast v608 : u32; - v673 = arith.add v671, v654 : u32 #[overflow = checked]; - v1225 = arith.constant 4 : u32; - v675 = arith.mod v673, v1225 : u32; - hir.assertz v675 #[code = 250]; - v676 = hir.int_to_ptr v673 : ptr; - v677 = hir.load v676 : i32; - scf.yield v677; + v662 = arith.constant 8 : i32; + v663 = arith.add v601, v662 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v663, v593, v625) + v647 = arith.constant 8 : u32; + v664 = hir.bitcast v601 : u32; + v666 = arith.add v664, v647 : u32 #[overflow = checked]; + v1218 = arith.constant 4 : u32; + v668 = arith.mod v666, v1218 : u32; + hir.assertz v668 #[code = 250]; + v669 = hir.int_to_ptr v666 : ptr; + v670 = hir.load v669 : i32; + scf.yield v670; }; - v1223 = arith.constant 0 : i32; - v1224 = arith.constant 0 : i32; - v686 = arith.eq v1187, v1224 : i1; - v687 = arith.zext v686 : u32; - v688 = hir.bitcast v687 : i32; - v690 = arith.neq v688, v1223 : i1; - scf.if v690{ + v1216 = arith.constant 0 : i32; + v1217 = arith.constant 0 : i32; + v679 = arith.eq v1180, v1217 : i1; + v680 = arith.zext v679 : u32; + v681 = hir.bitcast v680 : i32; + v683 = arith.neq v681, v1216 : i1; + scf.if v683{ ^block80: - v1222 = arith.constant 8 : u32; - v707 = hir.bitcast v597 : u32; - v709 = arith.add v707, v1222 : u32 #[overflow = checked]; - v1221 = arith.constant 4 : u32; - v711 = arith.mod v709, v1221 : u32; + v1215 = arith.constant 8 : u32; + v700 = hir.bitcast v590 : u32; + v702 = arith.add v700, v1215 : u32 #[overflow = checked]; + v1214 = arith.constant 4 : u32; + v704 = arith.mod v702, v1214 : u32; + hir.assertz v704 #[code = 250]; + v705 = hir.int_to_ptr v702 : ptr; + hir.store v705, v625; + v1213 = arith.constant 4 : u32; + v707 = hir.bitcast v590 : u32; + v709 = arith.add v707, v1213 : u32 #[overflow = checked]; + v1212 = arith.constant 4 : u32; + v711 = arith.mod v709, v1212 : u32; hir.assertz v711 #[code = 250]; v712 = hir.int_to_ptr v709 : ptr; - hir.store v712, v632; - v1220 = arith.constant 4 : u32; - v714 = hir.bitcast v597 : u32; - v716 = arith.add v714, v1220 : u32 #[overflow = checked]; - v1219 = arith.constant 4 : u32; - v718 = arith.mod v716, v1219 : u32; - hir.assertz v718 #[code = 250]; - v719 = hir.int_to_ptr v716 : ptr; - hir.store v719, v600; + hir.store v712, v593; scf.yield ; } else { ^block81: - v1218 = arith.constant 8 : u32; - v692 = hir.bitcast v597 : u32; - v694 = arith.add v692, v1218 : u32 #[overflow = checked]; - v1217 = arith.constant 4 : u32; - v696 = arith.mod v694, v1217 : u32; + v1211 = arith.constant 8 : u32; + v685 = hir.bitcast v590 : u32; + v687 = arith.add v685, v1211 : u32 #[overflow = checked]; + v1210 = arith.constant 4 : u32; + v689 = arith.mod v687, v1210 : u32; + hir.assertz v689 #[code = 250]; + v690 = hir.int_to_ptr v687 : ptr; + hir.store v690, v1180; + v1209 = arith.constant 4 : u32; + v692 = hir.bitcast v590 : u32; + v694 = arith.add v692, v1209 : u32 #[overflow = checked]; + v1208 = arith.constant 4 : u32; + v696 = arith.mod v694, v1208 : u32; hir.assertz v696 #[code = 250]; v697 = hir.int_to_ptr v694 : ptr; - hir.store v697, v1187; - v1216 = arith.constant 4 : u32; - v699 = hir.bitcast v597 : u32; - v701 = arith.add v699, v1216 : u32 #[overflow = checked]; - v1215 = arith.constant 4 : u32; - v703 = arith.mod v701, v1215 : u32; - hir.assertz v703 #[code = 250]; - v704 = hir.int_to_ptr v701 : ptr; - hir.store v704, v598; + hir.store v697, v591; scf.yield ; }; - v1213 = arith.constant 0 : i32; - v1214 = arith.constant 1 : i32; - v1186 = cf.select v690, v1214, v1213 : i32; - scf.yield v1186; + v1206 = arith.constant 0 : i32; + v1207 = arith.constant 1 : i32; + v1179 = cf.select v683, v1207, v1206 : i32; + scf.yield v1179; } else { ^block76: - v1212 = arith.constant 8 : u32; - v653 = hir.bitcast v597 : u32; - v655 = arith.add v653, v1212 : u32 #[overflow = checked]; - v1211 = arith.constant 4 : u32; - v657 = arith.mod v655, v1211 : u32; - hir.assertz v657 #[code = 250]; - v658 = hir.int_to_ptr v655 : ptr; - hir.store v658, v600; - v1210 = arith.constant 4 : u32; - v661 = hir.bitcast v597 : u32; - v663 = arith.add v661, v1210 : u32 #[overflow = checked]; - v1209 = arith.constant 4 : u32; - v665 = arith.mod v663, v1209 : u32; - hir.assertz v665 #[code = 250]; - v1208 = arith.constant 0 : i32; - v666 = hir.int_to_ptr v663 : ptr; - hir.store v666, v1208; - v1207 = arith.constant 0 : i32; - scf.yield v1207; + v1205 = arith.constant 8 : u32; + v646 = hir.bitcast v590 : u32; + v648 = arith.add v646, v1205 : u32 #[overflow = checked]; + v1204 = arith.constant 4 : u32; + v650 = arith.mod v648, v1204 : u32; + hir.assertz v650 #[code = 250]; + v651 = hir.int_to_ptr v648 : ptr; + hir.store v651, v593; + v1203 = arith.constant 4 : u32; + v654 = hir.bitcast v590 : u32; + v656 = arith.add v654, v1203 : u32 #[overflow = checked]; + v1202 = arith.constant 4 : u32; + v658 = arith.mod v656, v1202 : u32; + hir.assertz v658 #[code = 250]; + v1201 = arith.constant 0 : i32; + v659 = hir.int_to_ptr v656 : ptr; + hir.store v659, v1201; + v1200 = arith.constant 0 : i32; + scf.yield v1200; }; - scf.yield v1188; + scf.yield v1181; } else { ^block74: - v1206 = ub.poison i32 : i32; - scf.yield v1206; + v1199 = ub.poison i32 : i32; + scf.yield v1199; }; - v1201 = arith.constant 0 : u32; - v1134 = arith.constant 1 : u32; - v1194 = cf.select v641, v1134, v1201 : u32; - v1202 = ub.poison i32 : i32; - v1193 = cf.select v641, v608, v1202 : i32; - v1203 = ub.poison i32 : i32; - v1192 = cf.select v641, v597, v1203 : i32; - v1204 = ub.poison i32 : i32; - v1191 = cf.select v641, v1204, v608 : i32; - v1205 = ub.poison i32 : i32; - v1190 = cf.select v641, v1205, v597 : i32; - scf.yield v1190, v1191, v1192, v1189, v1193, v1194; + v1194 = arith.constant 0 : u32; + v1127 = arith.constant 1 : u32; + v1187 = cf.select v634, v1127, v1194 : u32; + v1195 = ub.poison i32 : i32; + v1186 = cf.select v634, v601, v1195 : i32; + v1196 = ub.poison i32 : i32; + v1185 = cf.select v634, v590, v1196 : i32; + v1197 = ub.poison i32 : i32; + v1184 = cf.select v634, v1197, v601 : i32; + v1198 = ub.poison i32 : i32; + v1183 = cf.select v634, v1198, v590 : i32; + scf.yield v1183, v1184, v1185, v1182, v1186, v1187; }; - v1147, v1148, v1149 = scf.index_switch v1146 : i32, i32, i32 + v1140, v1141, v1142 = scf.index_switch v1139 : i32, i32, i32 case 0 { ^block72: - v1200 = arith.constant 4 : u32; - v644 = hir.bitcast v1141 : u32; - v646 = arith.add v644, v1200 : u32 #[overflow = checked]; - v1199 = arith.constant 4 : u32; - v648 = arith.mod v646, v1199 : u32; - hir.assertz v648 #[code = 250]; - v1198 = arith.constant 0 : i32; - v649 = hir.int_to_ptr v646 : ptr; - hir.store v649, v1198; - v1197 = arith.constant 1 : i32; - scf.yield v1141, v1197, v1142; + v1193 = arith.constant 4 : u32; + v637 = hir.bitcast v1134 : u32; + v639 = arith.add v637, v1193 : u32 #[overflow = checked]; + v1192 = arith.constant 4 : u32; + v641 = arith.mod v639, v1192 : u32; + hir.assertz v641 #[code = 250]; + v1191 = arith.constant 0 : i32; + v642 = hir.int_to_ptr v639 : ptr; + hir.store v642, v1191; + v1190 = arith.constant 1 : i32; + scf.yield v1134, v1190, v1135; } default { ^block151: - scf.yield v1143, v1144, v1145; + scf.yield v1136, v1137, v1138; }; - v723 = hir.bitcast v1147 : u32; - v1196 = arith.constant 4 : u32; - v725 = arith.mod v723, v1196 : u32; - hir.assertz v725 #[code = 250]; - v726 = hir.int_to_ptr v723 : ptr; - hir.store v726, v1148; - v1195 = arith.constant 16 : i32; - v731 = arith.add v1149, v1195 : i32 #[overflow = wrapping]; - v732 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v733 = hir.bitcast v732 : ptr; - hir.store v733, v731; + v716 = hir.bitcast v1140 : u32; + v1189 = arith.constant 4 : u32; + v718 = arith.mod v716, v1189 : u32; + hir.assertz v718 #[code = 250]; + v719 = hir.int_to_ptr v716 : ptr; + hir.store v719, v1141; + v1188 = arith.constant 16 : i32; + v724 = arith.add v1142, v1188 : i32 #[overflow = wrapping]; + v725 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v726 = hir.bitcast v725 : ptr; + hir.store v726, v724; builtin.ret ; }; - private builtin.function @::allocate(v734: i32, v735: i32, v736: i32) { - ^block82(v734: i32, v735: i32, v736: i32): - v738 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v739 = hir.bitcast v738 : ptr; - v740 = hir.load v739 : i32; - v741 = arith.constant 16 : i32; - v742 = arith.sub v740, v741 : i32 #[overflow = wrapping]; - v743 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v744 = hir.bitcast v743 : ptr; - hir.store v744, v742; - v737 = arith.constant 0 : i32; - v745 = arith.constant 8 : i32; - v746 = arith.add v742, v745 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v746, v735, v736, v737) - v749 = arith.constant 12 : u32; - v748 = hir.bitcast v742 : u32; + private builtin.function @::allocate(v727: i32, v728: i32, v729: i32) { + ^block82(v727: i32, v728: i32, v729: i32): + v731 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v732 = hir.bitcast v731 : ptr; + v733 = hir.load v732 : i32; + v734 = arith.constant 16 : i32; + v735 = arith.sub v733, v734 : i32 #[overflow = wrapping]; + v736 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v737 = hir.bitcast v736 : ptr; + hir.store v737, v735; + v730 = arith.constant 0 : i32; + v738 = arith.constant 8 : i32; + v739 = arith.add v735, v738 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v739, v728, v729, v730) + v742 = arith.constant 12 : u32; + v741 = hir.bitcast v735 : u32; + v743 = arith.add v741, v742 : u32 #[overflow = checked]; + v744 = arith.constant 4 : u32; + v745 = arith.mod v743, v744 : u32; + hir.assertz v745 #[code = 250]; + v746 = hir.int_to_ptr v743 : ptr; + v747 = hir.load v746 : i32; + v749 = arith.constant 8 : u32; + v748 = hir.bitcast v735 : u32; v750 = arith.add v748, v749 : u32 #[overflow = checked]; - v751 = arith.constant 4 : u32; - v752 = arith.mod v750, v751 : u32; + v1227 = arith.constant 4 : u32; + v752 = arith.mod v750, v1227 : u32; hir.assertz v752 #[code = 250]; v753 = hir.int_to_ptr v750 : ptr; v754 = hir.load v753 : i32; - v756 = arith.constant 8 : u32; - v755 = hir.bitcast v742 : u32; - v757 = arith.add v755, v756 : u32 #[overflow = checked]; - v1234 = arith.constant 4 : u32; - v759 = arith.mod v757, v1234 : u32; - hir.assertz v759 #[code = 250]; - v760 = hir.int_to_ptr v757 : ptr; - v761 = hir.load v760 : i32; - v762 = hir.bitcast v734 : u32; - v1233 = arith.constant 4 : u32; - v764 = arith.mod v762, v1233 : u32; - hir.assertz v764 #[code = 250]; - v765 = hir.int_to_ptr v762 : ptr; - hir.store v765, v761; - v1232 = arith.constant 4 : u32; - v766 = hir.bitcast v734 : u32; - v768 = arith.add v766, v1232 : u32 #[overflow = checked]; - v1231 = arith.constant 4 : u32; - v770 = arith.mod v768, v1231 : u32; - hir.assertz v770 #[code = 250]; - v771 = hir.int_to_ptr v768 : ptr; - hir.store v771, v754; - v1230 = arith.constant 16 : i32; - v773 = arith.add v742, v1230 : i32 #[overflow = wrapping]; - v774 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v775 = hir.bitcast v774 : ptr; - hir.store v775, v773; + v755 = hir.bitcast v727 : u32; + v1226 = arith.constant 4 : u32; + v757 = arith.mod v755, v1226 : u32; + hir.assertz v757 #[code = 250]; + v758 = hir.int_to_ptr v755 : ptr; + hir.store v758, v754; + v1225 = arith.constant 4 : u32; + v759 = hir.bitcast v727 : u32; + v761 = arith.add v759, v1225 : u32 #[overflow = checked]; + v1224 = arith.constant 4 : u32; + v763 = arith.mod v761, v1224 : u32; + hir.assertz v763 #[code = 250]; + v764 = hir.int_to_ptr v761 : ptr; + hir.store v764, v747; + v1223 = arith.constant 16 : i32; + v766 = arith.add v735, v1223 : i32 #[overflow = wrapping]; + v767 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v768 = hir.bitcast v767 : ptr; + hir.store v768, v766; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v776: i32, v777: i32, v778: i32, v779: i32) { - ^block84(v776: i32, v777: i32, v778: i32, v779: i32): - v1250 = arith.constant 0 : i32; - v780 = arith.constant 0 : i32; - v781 = arith.eq v778, v780 : i1; - v782 = arith.zext v781 : u32; - v783 = hir.bitcast v782 : i32; - v785 = arith.neq v783, v1250 : i1; - v1246 = scf.if v785 : i32 { + private builtin.function @alloc::alloc::Global::alloc_impl(v769: i32, v770: i32, v771: i32, v772: i32) { + ^block84(v769: i32, v770: i32, v771: i32, v772: i32): + v1243 = arith.constant 0 : i32; + v773 = arith.constant 0 : i32; + v774 = arith.eq v771, v773 : i1; + v775 = arith.zext v774 : u32; + v776 = hir.bitcast v775 : i32; + v778 = arith.neq v776, v1243 : i1; + v1239 = scf.if v778 : i32 { ^block154: - scf.yield v777; + scf.yield v770; } else { ^block87: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1249 = arith.constant 0 : i32; - v787 = arith.neq v779, v1249 : i1; - v1245 = scf.if v787 : i32 { + v1242 = arith.constant 0 : i32; + v780 = arith.neq v772, v1242 : i1; + v1238 = scf.if v780 : i32 { ^block88: - v789 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v778, v777) : i32 - scf.yield v789; + v782 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v771, v770) : i32 + scf.yield v782; } else { ^block89: - v788 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v778, v777) : i32 - scf.yield v788; + v781 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v771, v770) : i32 + scf.yield v781; }; - scf.yield v1245; + scf.yield v1238; }; - v793 = arith.constant 4 : u32; - v792 = hir.bitcast v776 : u32; - v794 = arith.add v792, v793 : u32 #[overflow = checked]; - v1248 = arith.constant 4 : u32; - v796 = arith.mod v794, v1248 : u32; - hir.assertz v796 #[code = 250]; - v797 = hir.int_to_ptr v794 : ptr; - hir.store v797, v778; - v799 = hir.bitcast v776 : u32; - v1247 = arith.constant 4 : u32; - v801 = arith.mod v799, v1247 : u32; - hir.assertz v801 #[code = 250]; - v802 = hir.int_to_ptr v799 : ptr; - hir.store v802, v1246; + v786 = arith.constant 4 : u32; + v785 = hir.bitcast v769 : u32; + v787 = arith.add v785, v786 : u32 #[overflow = checked]; + v1241 = arith.constant 4 : u32; + v789 = arith.mod v787, v1241 : u32; + hir.assertz v789 #[code = 250]; + v790 = hir.int_to_ptr v787 : ptr; + hir.store v790, v771; + v792 = hir.bitcast v769 : u32; + v1240 = arith.constant 4 : u32; + v794 = arith.mod v792, v1240 : u32; + hir.assertz v794 #[code = 250]; + v795 = hir.int_to_ptr v792 : ptr; + hir.store v795, v1239; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v803: i32, v804: i32, v805: i32, v806: i32) { - ^block90(v803: i32, v804: i32, v805: i32, v806: i32): - v1276 = arith.constant 0 : i32; - v807 = arith.constant 0 : i32; - v811 = arith.eq v806, v807 : i1; - v812 = arith.zext v811 : u32; - v813 = hir.bitcast v812 : i32; - v815 = arith.neq v813, v1276 : i1; - v1263, v1264 = scf.if v815 : i32, i32 { + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v796: i32, v797: i32, v798: i32, v799: i32) { + ^block90(v796: i32, v797: i32, v798: i32, v799: i32): + v1269 = arith.constant 0 : i32; + v800 = arith.constant 0 : i32; + v804 = arith.eq v799, v800 : i1; + v805 = arith.zext v804 : u32; + v806 = hir.bitcast v805 : i32; + v808 = arith.neq v806, v1269 : i1; + v1256, v1257 = scf.if v808 : i32, i32 { ^block158: - v1275 = arith.constant 0 : i32; - v809 = arith.constant 4 : i32; - scf.yield v809, v1275; + v1268 = arith.constant 0 : i32; + v802 = arith.constant 4 : i32; + scf.yield v802, v1268; } else { ^block93: - v816 = hir.bitcast v804 : u32; - v851 = arith.constant 4 : u32; - v818 = arith.mod v816, v851 : u32; - hir.assertz v818 #[code = 250]; - v819 = hir.int_to_ptr v816 : ptr; - v820 = hir.load v819 : i32; - v1273 = arith.constant 0 : i32; - v1274 = arith.constant 0 : i32; - v822 = arith.eq v820, v1274 : i1; - v823 = arith.zext v822 : u32; - v824 = hir.bitcast v823 : i32; - v826 = arith.neq v824, v1273 : i1; - v1261 = scf.if v826 : i32 { + v809 = hir.bitcast v797 : u32; + v844 = arith.constant 4 : u32; + v811 = arith.mod v809, v844 : u32; + hir.assertz v811 #[code = 250]; + v812 = hir.int_to_ptr v809 : ptr; + v813 = hir.load v812 : i32; + v1266 = arith.constant 0 : i32; + v1267 = arith.constant 0 : i32; + v815 = arith.eq v813, v1267 : i1; + v816 = arith.zext v815 : u32; + v817 = hir.bitcast v816 : i32; + v819 = arith.neq v817, v1266 : i1; + v1254 = scf.if v819 : i32 { ^block157: - v1272 = arith.constant 0 : i32; - scf.yield v1272; + v1265 = arith.constant 0 : i32; + scf.yield v1265; } else { ^block94: - v1271 = arith.constant 4 : u32; - v827 = hir.bitcast v803 : u32; - v829 = arith.add v827, v1271 : u32 #[overflow = checked]; - v1270 = arith.constant 4 : u32; - v831 = arith.mod v829, v1270 : u32; - hir.assertz v831 #[code = 250]; - v832 = hir.int_to_ptr v829 : ptr; - hir.store v832, v805; - v1269 = arith.constant 4 : u32; - v833 = hir.bitcast v804 : u32; - v835 = arith.add v833, v1269 : u32 #[overflow = checked]; - v1268 = arith.constant 4 : u32; - v837 = arith.mod v835, v1268 : u32; - hir.assertz v837 #[code = 250]; - v838 = hir.int_to_ptr v835 : ptr; - v839 = hir.load v838 : i32; - v840 = hir.bitcast v803 : u32; - v1267 = arith.constant 4 : u32; - v842 = arith.mod v840, v1267 : u32; - hir.assertz v842 #[code = 250]; - v843 = hir.int_to_ptr v840 : ptr; - hir.store v843, v839; - v844 = arith.mul v820, v806 : i32 #[overflow = wrapping]; - scf.yield v844; + v1264 = arith.constant 4 : u32; + v820 = hir.bitcast v796 : u32; + v822 = arith.add v820, v1264 : u32 #[overflow = checked]; + v1263 = arith.constant 4 : u32; + v824 = arith.mod v822, v1263 : u32; + hir.assertz v824 #[code = 250]; + v825 = hir.int_to_ptr v822 : ptr; + hir.store v825, v798; + v1262 = arith.constant 4 : u32; + v826 = hir.bitcast v797 : u32; + v828 = arith.add v826, v1262 : u32 #[overflow = checked]; + v1261 = arith.constant 4 : u32; + v830 = arith.mod v828, v1261 : u32; + hir.assertz v830 #[code = 250]; + v831 = hir.int_to_ptr v828 : ptr; + v832 = hir.load v831 : i32; + v833 = hir.bitcast v796 : u32; + v1260 = arith.constant 4 : u32; + v835 = arith.mod v833, v1260 : u32; + hir.assertz v835 #[code = 250]; + v836 = hir.int_to_ptr v833 : ptr; + hir.store v836, v832; + v837 = arith.mul v813, v799 : i32 #[overflow = wrapping]; + scf.yield v837; }; - v845 = arith.constant 8 : i32; - v1266 = arith.constant 4 : i32; - v1262 = cf.select v826, v1266, v845 : i32; - scf.yield v1262, v1261; + v838 = arith.constant 8 : i32; + v1259 = arith.constant 4 : i32; + v1255 = cf.select v819, v1259, v838 : i32; + scf.yield v1255, v1254; }; - v848 = arith.add v803, v1263 : i32 #[overflow = wrapping]; - v850 = hir.bitcast v848 : u32; - v1265 = arith.constant 4 : u32; - v852 = arith.mod v850, v1265 : u32; - hir.assertz v852 #[code = 250]; - v853 = hir.int_to_ptr v850 : ptr; - hir.store v853, v1264; + v841 = arith.add v796, v1256 : i32 #[overflow = wrapping]; + v843 = hir.bitcast v841 : u32; + v1258 = arith.constant 4 : u32; + v845 = arith.mod v843, v1258 : u32; + hir.assertz v845 #[code = 250]; + v846 = hir.int_to_ptr v843 : ptr; + hir.store v846, v1257; builtin.ret ; }; - private builtin.function @::deallocate(v854: i32, v855: i32, v856: i32) { - ^block95(v854: i32, v855: i32, v856: i32): - v1278 = arith.constant 0 : i32; - v857 = arith.constant 0 : i32; - v858 = arith.eq v856, v857 : i1; - v859 = arith.zext v858 : u32; - v860 = hir.bitcast v859 : i32; - v862 = arith.neq v860, v1278 : i1; - scf.if v862{ + private builtin.function @::deallocate(v847: i32, v848: i32, v849: i32) { + ^block95(v847: i32, v848: i32, v849: i32): + v1271 = arith.constant 0 : i32; + v850 = arith.constant 0 : i32; + v851 = arith.eq v849, v850 : i1; + v852 = arith.zext v851 : u32; + v853 = hir.bitcast v852 : i32; + v855 = arith.neq v853, v1271 : i1; + scf.if v855{ ^block97: scf.yield ; } else { ^block98: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v854, v856, v855) + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v847, v849, v848) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v863: i32, v864: i32, v865: i32) { - ^block99(v863: i32, v864: i32, v865: i32): + private builtin.function @alloc::raw_vec::handle_error(v856: i32, v857: i32, v858: i32) { + ^block99(v856: i32, v857: i32, v858: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v866: i32, v867: i32) -> i32 { - ^block101(v866: i32, v867: i32): - v874 = arith.constant 0 : i32; - v870 = hir.bitcast v867 : u32; - v869 = hir.bitcast v866 : u32; - v871 = arith.gt v869, v870 : i1; - v872 = arith.zext v871 : u32; - v873 = hir.bitcast v872 : i32; - v875 = arith.neq v873, v874 : i1; - v876 = cf.select v875, v866, v867 : i32; - builtin.ret v876; + private builtin.function @core::ptr::alignment::Alignment::max(v859: i32, v860: i32) -> i32 { + ^block101(v859: i32, v860: i32): + v867 = arith.constant 0 : i32; + v863 = hir.bitcast v860 : u32; + v862 = hir.bitcast v859 : u32; + v864 = arith.gt v862, v863 : i1; + v865 = arith.zext v864 : u32; + v866 = hir.bitcast v865 : i32; + v868 = arith.neq v866, v867 : i1; + v869 = cf.select v868, v859, v860 : i32; + builtin.ret v869; }; - private builtin.function @miden::active_account::get_id(v877: i32) { - ^block103(v877: i32): - v878, v879 = hir.exec @miden/active_account/get_id() : felt, felt - v880 = hir.bitcast v877 : u32; - v881 = hir.int_to_ptr v880 : ptr; - hir.store v881, v878; - v882 = arith.constant 4 : u32; - v883 = arith.add v880, v882 : u32 #[overflow = checked]; - v884 = hir.int_to_ptr v883 : ptr; - hir.store v884, v879; + private builtin.function @miden::active_account::get_id(v870: i32) { + ^block103(v870: i32): + v871, v872 = hir.exec @miden/active_account/get_id() : felt, felt + v873 = hir.bitcast v870 : u32; + v874 = hir.int_to_ptr v873 : ptr; + hir.store v874, v871; + v875 = arith.constant 4 : u32; + v876 = arith.add v873, v875 : u32 #[overflow = checked]; + v877 = hir.int_to_ptr v876 : ptr; + hir.store v877, v872; builtin.ret ; }; - private builtin.function @miden::active_note::get_inputs(v885: i32) -> i32 { - ^block107(v885: i32): - v886, v887 = hir.exec @miden/active_note/get_inputs(v885) : i32, i32 - builtin.ret v886; + private builtin.function @miden::active_note::get_inputs(v878: i32) -> i32 { + ^block107(v878: i32): + v879, v880 = hir.exec @miden/active_note/get_inputs(v878) : i32, i32 + builtin.ret v879; }; - private builtin.function @miden::active_note::get_assets(v889: i32) -> i32 { - ^block110(v889: i32): - v890, v891 = hir.exec @miden/active_note/get_assets(v889) : i32, i32 - builtin.ret v890; + private builtin.function @miden::active_note::get_assets(v882: i32) -> i32 { + ^block110(v882: i32): + v883, v884 = hir.exec @miden/active_note/get_assets(v882) : i32, i32 + builtin.ret v883; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1283,14 +1278,14 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; - builtin.segment @1048628 = 0x000000220000003d0000003000100000000000210000001f0000003000100000000000010000000100000001; + builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v893: felt, v894: felt, v895: felt, v896: felt) { - ^block112(v893: felt, v894: felt, v895: felt, v896: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v893, v894, v895, v896) + public builtin.function @run(v886: felt, v887: felt, v888: felt, v889: felt) { + ^block112(v886: felt, v887: felt, v888: felt, v889: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v886, v887, v888, v889) 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 8a5c5e048..f690c0f7b 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -16,20 +16,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[9678401178389669350,4413180703889426351,1344973330089033162,11194032919842094804] + push.[3747760794384071571,1766386520481277932,2198275188940187258,538857382178104910] adv.push_mapval push.262144 - push.6 + push.3 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278552 + mem_store.278544 push.0 u32assert - mem_store.278553 + mem_store.278545 end # mod miden:base/note-script@1.0.0::p2id @@ -57,7 +57,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -65,7 +65,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048672 + push.1048616 u32wrapping_add movup.2 swap.1 @@ -85,7 +85,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -93,7 +93,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048672 + push.1048616 u32wrapping_add dup.1 swap.2 @@ -181,7 +181,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -191,7 +191,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop push.48 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -646,7 +646,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop push.48 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -682,7 +682,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -690,7 +690,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048676 + push.1048620 u32wrapping_add u32divmod.4 swap.1 @@ -711,7 +711,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -725,7 +725,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048676 + push.1048620 movup.2 u32wrapping_add u32divmod.4 @@ -944,8 +944,8 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc alloc::vec::Vec::with_capacity(i32, i32) - push.1114208 +proc alloc::vec::Vec::with_capacity(i32) + push.1114176 u32divmod.4 swap.1 trace.240 @@ -955,7 +955,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -970,9 +970,6 @@ proc alloc::vec::Vec::with_capacity(i32, i32) dup.2 u32wrapping_add dup.1 - movup.3 - swap.5 - movdn.3 swap.2 swap.1 trace.240 @@ -981,7 +978,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) trace.252 nop push.8 - dup.2 + dup.1 add u32assert push.8 @@ -998,7 +995,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) trace.252 nop push.8 - dup.3 + dup.4 add u32assert push.4 @@ -1016,7 +1013,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + movup.3 push.4 dup.1 swap.1 @@ -1032,7 +1029,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1044,12 +1041,11 @@ end @callconv("C") proc alloc::raw_vec::RawVecInner::with_capacity_in( - i32, i32, i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1059,7 +1055,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1125,8 +1121,6 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( neq neq if.true - movup.3 - drop push.12 dup.2 add @@ -1177,7 +1171,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1188,8 +1182,16 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( else movup.2 drop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + movup.3 add u32assert push.4 @@ -1205,7 +1207,10 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 + push.1048600 + movup.2 + u32wrapping_add + swap.2 trace.240 nop exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::handle_error @@ -1220,7 +1225,7 @@ end proc miden_base_sys::bindings::active_account::get_id( i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1230,7 +1235,7 @@ proc miden_base_sys::bindings::active_account::get_id( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1281,7 +1286,7 @@ proc miden_base_sys::bindings::active_account::get_id( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1295,7 +1300,7 @@ end proc miden_base_sys::bindings::active_note::get_inputs( i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1305,7 +1310,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1315,19 +1320,9 @@ proc miden_base_sys::bindings::active_note::get_inputs( exec.::intrinsics::mem::store_sw trace.252 nop - push.1114212 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048640 - u32wrapping_add push.4 push.8 - dup.3 + dup.2 u32wrapping_add dup.1 swap.2 @@ -1430,7 +1425,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1444,7 +1439,7 @@ end proc miden_base_sys::bindings::active_note::get_assets( i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1454,7 +1449,7 @@ proc miden_base_sys::bindings::active_note::get_assets( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1464,18 +1459,8 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop - push.1114212 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048656 - u32wrapping_add push.4 - dup.2 + dup.1 u32wrapping_add trace.240 nop @@ -1557,7 +1542,7 @@ proc miden_base_sys::bindings::active_note::get_assets( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1578,7 +1563,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1588,7 +1573,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1679,7 +1664,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1697,7 +1682,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1707,7 +1692,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -2092,7 +2077,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -2108,7 +2093,7 @@ proc ::allocate( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -2118,7 +2103,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -2211,7 +2196,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 0a9119715..2b16cf8cd 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -28,12 +28,11 @@ (type (;3;) (func (param i32 i32 i32))) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) - (type (;6;) (func (param i32 i32))) - (type (;7;) (func (param i32 i32 i32 i32))) - (type (;8;) (func (param i32))) - (type (;9;) (func (param f32 f32) (result i32))) - (type (;10;) (func (param i32 i32 i32 i32 i32))) - (type (;11;) (func (param i32) (result i32))) + (type (;6;) (func (param i32))) + (type (;7;) (func (param f32 f32) (result i32))) + (type (;8;) (func (param i32 i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32 i32))) + (type (;10;) (func (param i32) (result i32))) (import "miden:basic-wallet/basic-wallet@0.1.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -45,7 +44,7 @@ (func $__wasm_call_ctors (;1;) (type 1)) (func $__rustc::__rust_alloc (;2;) (type 2) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048672 + i32.const 1048616 i32.add local.get 1 local.get 0 @@ -55,7 +54,7 @@ (func $__rustc::__rust_alloc_zeroed (;4;) (type 2) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048672 + i32.const 1048616 i32.add local.get 1 local.get 0 @@ -194,7 +193,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048676 + i32.const 1048620 i32.add i32.load8_u br_if 0 (;@1;) @@ -202,7 +201,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048676 + i32.const 1048620 i32.add i32.const 1 i32.store8 @@ -283,42 +282,41 @@ (func $intrinsics::mem::heap_base (;10;) (type 5) (result i32) unreachable ) - (func $alloc::vec::Vec::with_capacity (;11;) (type 6) (param i32 i32) + (func $alloc::vec::Vec::with_capacity (;11;) (type 6) (param i32) (local i32 i64) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 2 + local.tee 1 global.set $__stack_pointer - local.get 2 + local.get 1 i32.const 8 i32.add i32.const 16 i32.const 16 - local.get 1 call $alloc::raw_vec::RawVecInner::with_capacity_in - local.get 2 + local.get 1 i64.load offset=8 - local.set 3 + local.set 2 local.get 0 i32.const 0 i32.store offset=8 local.get 0 - local.get 3 - i64.store align=4 local.get 2 + i64.store align=4 + local.get 1 i32.const 16 i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;12;) (type 7) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;12;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 4 + local.tee 3 global.set $__stack_pointer - local.get 4 + local.get 3 i32.const 4 i32.add i32.const 256 @@ -326,35 +324,39 @@ local.get 1 local.get 2 call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 4 + local.get 3 i32.load offset=8 local.set 2 block ;; label = @1 - local.get 4 + local.get 3 i32.load offset=4 i32.const 1 i32.ne br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 local.get 2 - local.get 4 - i32.load offset=12 local.get 3 + i32.load offset=12 + local.get 0 + i32.const 1048600 + i32.add call $alloc::raw_vec::handle_error unreachable end local.get 0 - local.get 4 + local.get 3 i32.load offset=12 i32.store offset=4 local.get 0 local.get 2 i32.store - local.get 4 + local.get 3 i32.const 16 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_account::get_id (;13;) (type 8) (param i32) + (func $miden_base_sys::bindings::active_account::get_id (;13;) (type 6) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -374,7 +376,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_inputs (;14;) (type 8) (param i32) + (func $miden_base_sys::bindings::active_note::get_inputs (;14;) (type 6) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -386,9 +388,6 @@ i32.add i32.const 4 i32.const 4 - global.get $GOT.data.internal.__memory_base - i32.const 1048640 - i32.add call $alloc::raw_vec::RawVecInner::with_capacity_in local.get 1 i32.load offset=8 @@ -412,7 +411,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_assets (;15;) (type 8) (param i32) + (func $miden_base_sys::bindings::active_note::get_assets (;15;) (type 6) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -422,9 +421,6 @@ local.get 1 i32.const 4 i32.add - global.get $GOT.data.internal.__memory_base - i32.const 1048656 - i32.add call $alloc::vec::Vec::with_capacity local.get 0 i32.const 8 @@ -444,7 +440,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::eq (;16;) (type 9) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;16;) (type 7) (param f32 f32) (result i32) unreachable ) (func $alloc::raw_vec::RawVecInner::deallocate (;17;) (type 3) (param i32 i32 i32) @@ -479,7 +475,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;18;) (type 10) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;18;) (type 8) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -620,7 +616,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;20;) (type 7) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;20;) (type 9) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -647,7 +643,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;21;) (type 7) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;21;) (type 9) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -704,17 +700,17 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;25;) (type 8) (param i32) + (func $miden::active_account::get_id (;25;) (type 6) (param i32) unreachable ) - (func $miden::active_note::get_inputs (;26;) (type 11) (param i32) (result i32) + (func $miden::active_note::get_inputs (;26;) (type 10) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_assets (;27;) (type 11) (param i32) (result i32) + (func $miden::active_note::get_assets (;27;) (type 10) (param i32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/active_note.rs\00") - (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00\1f\00\00\00!\00\00\00\00\00\10\000\00\00\00=\00\00\00\22\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "word" (type (;3;))) (alias export 1 "receive-asset" (func (;0;))) 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 18ac9892e..68b991703 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,7 +10,7 @@ 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 1048648 : i32; + v6 = arith.constant 1048612 : 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; @@ -26,36 +26,36 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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 1048648 : i32; + v18 = arith.constant 1048612 : 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 - v668 = arith.constant 0 : i32; + v666 = 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, v668 : i1; + v26 = arith.neq v24, v666 : i1; scf.if v26{ ^block13: scf.yield ; } else { ^block14: - v666 = arith.constant 0 : i32; - v667 = arith.constant 0 : i32; - v28 = arith.eq v12, v667 : i1; + v664 = arith.constant 0 : i32; + v665 = arith.constant 0 : i32; + v28 = arith.eq v12, v665 : i1; v29 = arith.zext v28 : u32; v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v666 : i1; + v32 = arith.neq v30, v664 : i1; scf.if v32{ ^block94: scf.yield ; } else { ^block15: - v660 = arith.constant 0 : u8; + v658 = 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, v660; + hir.mem_set v37, v35, v658; scf.yield ; }; scf.yield ; @@ -93,12 +93,12 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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 - v670 = arith.constant 16 : i32; - v671 = arith.constant 4 : i32; - v62 = arith.add v46, v671 : 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::raw_vec::RawVecInner::deallocate(v62, v670, v670) - v669 = arith.constant 16 : i32; - v66 = arith.add v46, v669 : i32 #[overflow = wrapping]; + v668 = arith.constant 16 : i32; + v669 = arith.constant 4 : i32; + v62 = arith.add v46, v669 : 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::raw_vec::RawVecInner::deallocate(v62, v668, v668) + v667 = arith.constant 16 : i32; + v66 = arith.add v46, v667 : 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; @@ -115,7 +115,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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 1048652 : i32; + v73 = arith.constant 1048616 : i32; v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; v75 = hir.bitcast v74 : u32; v76 = hir.int_to_ptr v75 : ptr; @@ -133,12 +133,12 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v83 = hir.bitcast v82 : ptr; v84 = hir.load v83 : 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/__wasm_call_ctors() - v673 = arith.constant 1 : u8; - v675 = arith.constant 1048652 : i32; - v86 = arith.add v84, v675 : i32 #[overflow = wrapping]; + v671 = arith.constant 1 : u8; + v673 = arith.constant 1048616 : i32; + v86 = arith.add v84, v673 : i32 #[overflow = wrapping]; v90 = hir.bitcast v86 : u32; v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v673; + hir.store v91, v671; scf.yield ; }; builtin.ret ; @@ -148,27 +148,27 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no ^block26(v92: i32, v93: i32, v94: i32): v97 = arith.constant 16 : i32; v96 = arith.constant 0 : i32; - v677 = arith.constant 16 : u32; + v675 = arith.constant 16 : u32; v99 = hir.bitcast v93 : u32; - v101 = arith.gt v99, v677 : i1; + v101 = arith.gt v99, v675 : i1; v102 = arith.zext v101 : u32; v103 = hir.bitcast v102 : i32; v105 = arith.neq v103, v96 : i1; v106 = cf.select v105, v93, v97 : i32; - v717 = arith.constant 0 : i32; + v715 = 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, v717 : i1; - v686, v687 = scf.if v111 : i32, u32 { + v111 = arith.neq v109, v715 : i1; + v684, v685 = scf.if v111 : i32, u32 { ^block100: - v678 = arith.constant 0 : u32; - v682 = ub.poison i32 : i32; - scf.yield v682, v678; + v676 = arith.constant 0 : u32; + v680 = ub.poison i32 : i32; + scf.yield v680, v676; } 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/core::ptr::alignment::Alignment::max(v93, v106) : i32 - v716 = arith.constant 0 : i32; + v714 = arith.constant 0 : i32; v112 = arith.constant -2147483648 : i32; v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; v116 = hir.bitcast v114 : u32; @@ -176,18 +176,18 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v117 = arith.gt v115, v116 : i1; v118 = arith.zext v117 : u32; v119 = hir.bitcast v118 : i32; - v121 = arith.neq v119, v716 : i1; - v701 = scf.if v121 : i32 { + v121 = arith.neq v119, v714 : i1; + v699 = scf.if v121 : i32 { ^block99: - v715 = ub.poison i32 : i32; - scf.yield v715; + v713 = ub.poison i32 : i32; + scf.yield v713; } else { ^block30: - v713 = arith.constant 0 : i32; - v127 = arith.sub v713, v113 : i32 #[overflow = wrapping]; - v714 = arith.constant -1 : i32; + v711 = arith.constant 0 : i32; + v127 = arith.sub v711, v113 : i32 #[overflow = wrapping]; + v712 = arith.constant -1 : i32; v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; - v125 = arith.add v123, v714 : i32 #[overflow = wrapping]; + v125 = arith.add v123, v712 : i32 #[overflow = wrapping]; v128 = arith.band v125, v127 : i32; v129 = hir.bitcast v92 : u32; v130 = arith.constant 4 : u32; @@ -195,8 +195,8 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no hir.assertz v131 #[code = 250]; v132 = hir.int_to_ptr v129 : ptr; v133 = hir.load v132 : i32; - v712 = arith.constant 0 : i32; - v135 = arith.neq v133, v712 : i1; + v710 = arith.constant 0 : i32; + v135 = arith.neq v133, v710 : i1; scf.if v135{ ^block98: scf.yield ; @@ -205,41 +205,41 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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; - v711 = arith.constant 4 : u32; - v145 = arith.mod v143, v711 : u32; + v709 = arith.constant 4 : u32; + v145 = arith.mod v143, v709 : u32; hir.assertz v145 #[code = 250]; - v710 = arith.constant 16 : u32; + v708 = arith.constant 16 : u32; v138 = hir.bitcast v137 : i32; - v141 = arith.shl v138, v710 : i32; + v141 = arith.shl v138, v708 : i32; v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; v146 = hir.int_to_ptr v143 : ptr; hir.store v146, v142; scf.yield ; }; v149 = hir.bitcast v92 : u32; - v709 = arith.constant 4 : u32; - v151 = arith.mod v149, v709 : u32; + v707 = arith.constant 4 : u32; + v151 = arith.mod v149, v707 : u32; hir.assertz v151 #[code = 250]; v152 = hir.int_to_ptr v149 : ptr; v153 = hir.load v152 : i32; - v707 = arith.constant 0 : i32; - v708 = arith.constant -1 : i32; - v155 = arith.bxor v153, v708 : i32; + v705 = arith.constant 0 : i32; + v706 = arith.constant -1 : i32; + v155 = arith.bxor v153, v706 : 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, v707 : i1; - v700 = scf.if v162 : i32 { + v162 = arith.neq v160, v705 : i1; + v698 = scf.if v162 : i32 { ^block33: - v706 = arith.constant 0 : i32; - scf.yield v706; + v704 = arith.constant 0 : i32; + scf.yield v704; } else { ^block34: v164 = hir.bitcast v92 : u32; - v705 = arith.constant 4 : u32; - v166 = arith.mod v164, v705 : u32; + v703 = arith.constant 4 : u32; + v166 = arith.mod v164, v703 : u32; hir.assertz v166 #[code = 250]; v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; v167 = hir.int_to_ptr v164 : ptr; @@ -247,20 +247,20 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; scf.yield v169; }; - scf.yield v700; + scf.yield v698; }; - v683 = arith.constant 1 : u32; - v704 = arith.constant 0 : u32; - v702 = cf.select v121, v704, v683 : u32; - scf.yield v701, v702; + v681 = arith.constant 1 : u32; + v702 = arith.constant 0 : u32; + v700 = cf.select v121, v702, v681 : u32; + scf.yield v699, v700; }; - v703 = arith.constant 0 : u32; - v699 = arith.eq v687, v703 : i1; - cf.cond_br v699 ^block28, ^block102(v686); + v701 = arith.constant 0 : u32; + v697 = arith.eq v685, v701 : i1; + cf.cond_br v697 ^block28, ^block102(v684); ^block28: ub.unreachable ; - ^block102(v679: i32): - builtin.ret v679; + ^block102(v677: i32): + builtin.ret v677; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -269,672 +269,672 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no builtin.ret v172; }; - private builtin.function @alloc::vec::Vec::with_capacity(v174: i32, v175: i32) { - ^block39(v174: i32, v175: i32): - v178 = 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 - v179 = hir.bitcast v178 : ptr; - v180 = hir.load v179 : i32; - v181 = arith.constant 16 : i32; - v182 = arith.sub v180, v181 : i32 #[overflow = wrapping]; - v183 = 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 - v184 = hir.bitcast v183 : ptr; - hir.store v184, v182; - v722 = arith.constant 16 : i32; - v185 = arith.constant 8 : i32; - v186 = arith.add v182, v185 : 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::raw_vec::RawVecInner::with_capacity_in(v186, v722, v722, v175) - v190 = arith.constant 8 : u32; - v189 = hir.bitcast v182 : u32; - v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v721 = arith.constant 8 : u32; - v193 = arith.mod v191, v721 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - v195 = hir.load v194 : i64; - v720 = arith.constant 8 : u32; - v197 = hir.bitcast v174 : u32; - v199 = arith.add v197, v720 : u32 #[overflow = checked]; - v200 = arith.constant 4 : u32; - v201 = arith.mod v199, v200 : u32; - hir.assertz v201 #[code = 250]; - v176 = arith.constant 0 : i32; - v202 = hir.int_to_ptr v199 : ptr; - hir.store v202, v176; - v203 = hir.bitcast v174 : u32; - v719 = arith.constant 4 : u32; - v205 = arith.mod v203, v719 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v195; - v718 = arith.constant 16 : i32; - v208 = arith.add v182, v718 : i32 #[overflow = wrapping]; - v209 = 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 - v210 = hir.bitcast v209 : ptr; - hir.store v210, v208; + private builtin.function @alloc::vec::Vec::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; + v720 = 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/alloc::raw_vec::RawVecInner::with_capacity_in(v185, v720, v720) + v189 = arith.constant 8 : u32; + v188 = hir.bitcast v181 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v719 = arith.constant 8 : u32; + v192 = arith.mod v190, v719 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + v194 = hir.load v193 : i64; + v718 = arith.constant 8 : u32; + v196 = hir.bitcast v174 : u32; + v198 = arith.add v196, v718 : 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; + v717 = arith.constant 4 : u32; + v204 = arith.mod v202, v717 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v194; + v716 = arith.constant 16 : i32; + v207 = arith.add v181, v716 : 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v211: i32, v212: i32, v213: i32, v214: i32) { - ^block41(v211: i32, v212: i32, v213: i32, v214: i32): - v216 = 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 - v217 = hir.bitcast v216 : ptr; - v218 = hir.load v217 : i32; - v219 = arith.constant 16 : i32; - v220 = arith.sub v218, v219 : i32 #[overflow = wrapping]; - v221 = 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 - v222 = hir.bitcast v221 : ptr; - hir.store v222, v220; - v215 = arith.constant 0 : i32; - v225 = arith.constant 256 : i32; - v223 = arith.constant 4 : i32; - v224 = arith.add v220, v223 : 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::raw_vec::RawVecInner::try_allocate_in(v224, v225, v215, v212, v213) - v228 = arith.constant 8 : u32; - v227 = hir.bitcast v220 : u32; - v229 = arith.add v227, v228 : u32 #[overflow = checked]; - v230 = arith.constant 4 : u32; - v231 = arith.mod v229, v230 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : i32; - v733 = arith.constant 4 : u32; - v234 = hir.bitcast v220 : u32; - v236 = arith.add v234, v733 : u32 #[overflow = checked]; - v732 = arith.constant 4 : u32; - v238 = arith.mod v236, v732 : u32; - hir.assertz v238 #[code = 250]; - v239 = hir.int_to_ptr v236 : ptr; - v240 = hir.load v239 : i32; - v731 = arith.constant 0 : i32; - v241 = arith.constant 1 : i32; - v242 = arith.neq v240, v241 : i1; - v243 = arith.zext v242 : u32; - v244 = hir.bitcast v243 : i32; - v246 = arith.neq v244, v731 : i1; - cf.cond_br v246 ^block43, ^block44; - ^block43: - v255 = arith.constant 12 : u32; - v254 = hir.bitcast v220 : u32; - v256 = arith.add v254, v255 : u32 #[overflow = checked]; + private builtin.function @alloc::raw_vec::RawVecInner::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/alloc::raw_vec::RawVecInner::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; + v731 = arith.constant 4 : u32; + v232 = hir.bitcast v218 : u32; + v234 = arith.add v232, v731 : u32 #[overflow = checked]; v730 = arith.constant 4 : u32; - v258 = arith.mod v256, v730 : u32; - hir.assertz v258 #[code = 250]; - v259 = hir.int_to_ptr v256 : ptr; - v260 = hir.load v259 : i32; - v729 = arith.constant 4 : u32; - v261 = hir.bitcast v211 : u32; - v263 = arith.add v261, v729 : u32 #[overflow = checked]; + v236 = arith.mod v234, v730 : u32; + hir.assertz v236 #[code = 250]; + v237 = hir.int_to_ptr v234 : ptr; + v238 = hir.load v237 : i32; + v729 = 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, v729 : i1; + cf.cond_br v244 ^block43, ^block44; + ^block43: + v258 = arith.constant 12 : u32; + v257 = hir.bitcast v218 : u32; + v259 = arith.add v257, v258 : u32 #[overflow = checked]; v728 = arith.constant 4 : u32; - v265 = arith.mod v263, v728 : u32; - hir.assertz v265 #[code = 250]; - v266 = hir.int_to_ptr v263 : ptr; - hir.store v266, v260; - v267 = hir.bitcast v211 : u32; + v261 = arith.mod v259, v728 : u32; + hir.assertz v261 #[code = 250]; + v262 = hir.int_to_ptr v259 : ptr; + v263 = hir.load v262 : i32; v727 = arith.constant 4 : u32; - v269 = arith.mod v267, v727 : u32; - hir.assertz v269 #[code = 250]; - v270 = hir.int_to_ptr v267 : ptr; - hir.store v270, v233; - v726 = arith.constant 16 : i32; - v272 = arith.add v220, v726 : i32 #[overflow = wrapping]; - v273 = 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 - v274 = hir.bitcast v273 : ptr; - hir.store v274, v272; + v264 = hir.bitcast v210 : u32; + v266 = arith.add v264, v727 : u32 #[overflow = checked]; + v726 = arith.constant 4 : u32; + v268 = arith.mod v266, v726 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + hir.store v269, v263; + v270 = hir.bitcast v210 : u32; + v725 = arith.constant 4 : u32; + v272 = arith.mod v270, v725 : u32; + hir.assertz v272 #[code = 250]; + v273 = hir.int_to_ptr v270 : ptr; + hir.store v273, v231; + v724 = arith.constant 16 : i32; + v275 = arith.add v218, v724 : i32 #[overflow = wrapping]; + 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; + hir.store v277, v275; builtin.ret ; ^block44: - v725 = arith.constant 12 : u32; - v247 = hir.bitcast v220 : u32; - v249 = arith.add v247, v725 : u32 #[overflow = checked]; - v724 = arith.constant 4 : u32; - v251 = arith.mod v249, v724 : u32; - hir.assertz v251 #[code = 250]; - v252 = hir.int_to_ptr v249 : ptr; - v253 = hir.load v252 : 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(v233, v253, v214) + v245 = 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 + v246 = hir.bitcast v245 : ptr; + v247 = hir.load v246 : i32; + v723 = arith.constant 12 : u32; + v248 = hir.bitcast v218 : u32; + v250 = arith.add v248, v723 : u32 #[overflow = checked]; + v722 = arith.constant 4 : u32; + v252 = arith.mod v250, v722 : u32; + hir.assertz v252 #[code = 250]; + v253 = hir.int_to_ptr v250 : ptr; + v254 = hir.load v253 : i32; + v255 = arith.constant 1048596 : i32; + v256 = arith.add v247, v255 : 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::raw_vec::handle_error(v231, v254, v256) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_assets(v275: i32, v276: felt) { - ^block45(v275: i32, v276: felt): - v278 = 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 - v279 = hir.bitcast v278 : ptr; - v280 = hir.load v279 : i32; - v281 = arith.constant 16 : i32; - v282 = arith.sub v280, v281 : i32 #[overflow = wrapping]; - v283 = 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 - v284 = hir.bitcast v283 : ptr; - hir.store v284, v282; - v287 = 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 - v288 = hir.bitcast v287 : ptr; - v289 = hir.load v288 : i32; - v290 = arith.constant 1048632 : i32; - v291 = arith.add v289, v290 : i32 #[overflow = wrapping]; - v285 = arith.constant 4 : i32; - v286 = arith.add v282, v285 : 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::vec::Vec::with_capacity(v286, v291) - v295 = arith.constant 8 : u32; - v294 = hir.bitcast v282 : u32; - v296 = arith.add v294, v295 : 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; - v300 = hir.load v299 : i32; - v734 = arith.constant 2 : u32; - v302 = hir.bitcast v300 : u32; - v304 = arith.shr v302, v734 : u32; - v305 = hir.bitcast v304 : i32; - v306 = 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(v305, v276) : i32 - v292 = arith.constant 8 : i32; - v293 = arith.add v275, v292 : i32 #[overflow = wrapping]; - v307 = hir.bitcast v293 : u32; - v739 = arith.constant 4 : u32; - v309 = arith.mod v307, v739 : u32; - hir.assertz v309 #[code = 250]; - v310 = hir.int_to_ptr v307 : ptr; - hir.store v310, v306; - v738 = arith.constant 4 : u32; - v311 = hir.bitcast v282 : u32; - v313 = arith.add v311, v738 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::input_note::get_assets(v278: i32, v279: felt) { + ^block45(v278: i32, v279: felt): + 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; + v283 = hir.load v282 : i32; + v284 = arith.constant 16 : i32; + v285 = arith.sub v283, v284 : i32 #[overflow = wrapping]; + v286 = 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 + v287 = hir.bitcast v286 : ptr; + hir.store v287, v285; + v288 = arith.constant 4 : i32; + v289 = arith.add v285, v288 : 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::vec::Vec::with_capacity(v289) + v293 = arith.constant 8 : u32; + v292 = hir.bitcast v285 : u32; + v294 = arith.add v292, v293 : u32 #[overflow = checked]; + v295 = arith.constant 4 : u32; + v296 = arith.mod v294, v295 : u32; + hir.assertz v296 #[code = 250]; + v297 = hir.int_to_ptr v294 : ptr; + v298 = hir.load v297 : i32; + v732 = arith.constant 2 : u32; + v300 = hir.bitcast v298 : u32; + v302 = arith.shr v300, v732 : u32; + v303 = hir.bitcast v302 : i32; + v304 = 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(v303, v279) : i32 + v290 = arith.constant 8 : i32; + v291 = arith.add v278, v290 : i32 #[overflow = wrapping]; + v305 = hir.bitcast v291 : u32; v737 = arith.constant 4 : u32; - v315 = arith.mod v313, v737 : u32; - hir.assertz v315 #[code = 250]; - v316 = hir.int_to_ptr v313 : ptr; - v317 = hir.load v316 : i64; - v318 = hir.bitcast v275 : u32; + v307 = arith.mod v305, v737 : u32; + hir.assertz v307 #[code = 250]; + v308 = hir.int_to_ptr v305 : ptr; + hir.store v308, v304; v736 = arith.constant 4 : u32; - v320 = arith.mod v318, v736 : u32; - hir.assertz v320 #[code = 250]; - v321 = hir.int_to_ptr v318 : ptr; - hir.store v321, v317; - v735 = arith.constant 16 : i32; - v323 = arith.add v282, v735 : i32 #[overflow = wrapping]; - v324 = 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 - v325 = hir.bitcast v324 : ptr; - hir.store v325, v323; + v309 = hir.bitcast v285 : u32; + v311 = arith.add v309, v736 : u32 #[overflow = checked]; + v735 = arith.constant 4 : u32; + v313 = arith.mod v311, v735 : u32; + hir.assertz v313 #[code = 250]; + v314 = hir.int_to_ptr v311 : ptr; + v315 = hir.load v314 : i64; + v316 = hir.bitcast v278 : u32; + v734 = arith.constant 4 : u32; + v318 = arith.mod v316, v734 : u32; + hir.assertz v318 #[code = 250]; + v319 = hir.int_to_ptr v316 : ptr; + hir.store v319, v315; + v733 = arith.constant 16 : i32; + v321 = arith.add v285, v733 : i32 #[overflow = wrapping]; + v322 = 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 + v323 = hir.bitcast v322 : ptr; + hir.store v323, v321; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v326: i32) -> felt { - ^block47(v326: i32): - v327 = hir.bitcast v326 : felt; - builtin.ret v327; + private builtin.function @intrinsics::felt::from_u32(v324: i32) -> felt { + ^block47(v324: i32): + v325 = hir.bitcast v324 : felt; + builtin.ret v325; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v329: i32, v330: i32, v331: i32) { - ^block49(v329: i32, v330: i32, v331: i32): - v333 = 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 - v334 = hir.bitcast v333 : ptr; - v335 = hir.load v334 : i32; - v336 = arith.constant 16 : i32; - v337 = arith.sub v335, v336 : i32 #[overflow = wrapping]; - v338 = 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 - v339 = hir.bitcast v338 : ptr; - hir.store v339, v337; - v340 = arith.constant 4 : i32; - v341 = arith.add v337, v340 : 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::raw_vec::RawVecInner::current_memory(v341, v329, v330, v331) - v343 = arith.constant 8 : u32; - v342 = hir.bitcast v337 : u32; - v344 = arith.add v342, v343 : u32 #[overflow = checked]; - v345 = arith.constant 4 : u32; - v346 = arith.mod v344, v345 : u32; - hir.assertz v346 #[code = 250]; - v347 = hir.int_to_ptr v344 : ptr; - v348 = hir.load v347 : i32; - v746 = arith.constant 0 : i32; - v332 = arith.constant 0 : i32; - v350 = arith.eq v348, v332 : i1; - v351 = arith.zext v350 : u32; - v352 = hir.bitcast v351 : i32; - v354 = arith.neq v352, v746 : i1; - scf.if v354{ + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v327: i32, v328: i32, v329: i32) { + ^block49(v327: i32, v328: i32, v329: i32): + v331 = 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 + v332 = hir.bitcast v331 : ptr; + v333 = hir.load v332 : i32; + v334 = arith.constant 16 : i32; + v335 = arith.sub v333, v334 : i32 #[overflow = wrapping]; + v336 = 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 + v337 = hir.bitcast v336 : ptr; + hir.store v337, v335; + v338 = arith.constant 4 : i32; + v339 = arith.add v335, v338 : 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::raw_vec::RawVecInner::current_memory(v339, v327, v328, v329) + v341 = arith.constant 8 : u32; + v340 = hir.bitcast v335 : u32; + v342 = arith.add v340, v341 : u32 #[overflow = checked]; + v343 = arith.constant 4 : u32; + v344 = arith.mod v342, v343 : u32; + hir.assertz v344 #[code = 250]; + v345 = hir.int_to_ptr v342 : ptr; + v346 = hir.load v345 : i32; + v744 = arith.constant 0 : i32; + v330 = arith.constant 0 : i32; + v348 = arith.eq v346, v330 : i1; + v349 = arith.zext v348 : u32; + v350 = hir.bitcast v349 : i32; + v352 = arith.neq v350, v744 : i1; + scf.if v352{ ^block108: scf.yield ; } else { ^block52: - v745 = arith.constant 4 : u32; - v355 = hir.bitcast v337 : u32; - v357 = arith.add v355, v745 : u32 #[overflow = checked]; - v744 = arith.constant 4 : u32; - v359 = arith.mod v357, v744 : u32; - hir.assertz v359 #[code = 250]; - v360 = hir.int_to_ptr v357 : ptr; - v361 = hir.load v360 : i32; - v363 = arith.constant 12 : u32; - v362 = hir.bitcast v337 : u32; - v364 = arith.add v362, v363 : u32 #[overflow = checked]; v743 = arith.constant 4 : u32; - v366 = arith.mod v364, v743 : u32; - hir.assertz v366 #[code = 250]; - v367 = hir.int_to_ptr v364 : ptr; - v368 = hir.load v367 : 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(v361, v348, v368) + v353 = hir.bitcast v335 : u32; + v355 = arith.add v353, v743 : u32 #[overflow = checked]; + v742 = arith.constant 4 : u32; + v357 = arith.mod v355, v742 : u32; + hir.assertz v357 #[code = 250]; + v358 = hir.int_to_ptr v355 : ptr; + v359 = hir.load v358 : i32; + v361 = arith.constant 12 : u32; + v360 = hir.bitcast v335 : u32; + v362 = arith.add v360, v361 : u32 #[overflow = checked]; + v741 = arith.constant 4 : u32; + v364 = arith.mod v362, v741 : u32; + hir.assertz v364 #[code = 250]; + v365 = hir.int_to_ptr v362 : ptr; + v366 = hir.load v365 : 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(v359, v346, v366) scf.yield ; }; - v742 = arith.constant 16 : i32; - v371 = arith.add v337, v742 : i32 #[overflow = wrapping]; - v372 = 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 - v373 = hir.bitcast v372 : ptr; - hir.store v373, v371; + v740 = arith.constant 16 : i32; + v369 = arith.add v335, v740 : i32 #[overflow = wrapping]; + v370 = 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 + v371 = hir.bitcast v370 : ptr; + hir.store v371, v369; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32) { - ^block53(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32): - v381 = 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 - v382 = hir.bitcast v381 : ptr; - v383 = hir.load v382 : i32; - v384 = arith.constant 16 : i32; - v385 = arith.sub v383, v384 : i32 #[overflow = wrapping]; - v386 = 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 - v387 = hir.bitcast v386 : ptr; - hir.store v387, v385; - v397 = hir.bitcast v375 : u32; - v398 = arith.zext v397 : u64; - v399 = hir.bitcast v398 : i64; - v379 = arith.constant 0 : i32; - v392 = arith.sub v379, v377 : i32 #[overflow = wrapping]; - v389 = arith.constant -1 : i32; - v388 = arith.add v377, v378 : i32 #[overflow = wrapping]; - v390 = arith.add v388, v389 : i32 #[overflow = wrapping]; - v393 = arith.band v390, v392 : i32; - v394 = hir.bitcast v393 : u32; - v395 = arith.zext v394 : u64; - v396 = hir.bitcast v395 : i64; - v400 = arith.mul v396, v399 : i64 #[overflow = wrapping]; - v850 = arith.constant 0 : i32; - v401 = arith.constant 32 : i64; - v403 = hir.cast v401 : u32; - v402 = hir.bitcast v400 : u64; - v404 = arith.shr v402, v403 : u64; - v405 = hir.bitcast v404 : i64; - v406 = arith.trunc v405 : i32; - v408 = arith.neq v406, v850 : i1; - v762, v763, v764, v765, v766, v767 = scf.if v408 : i32, i32, i32, i32, i32, u32 { + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32) { + ^block53(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32): + v379 = 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 + v380 = hir.bitcast v379 : ptr; + v381 = hir.load v380 : i32; + v382 = arith.constant 16 : i32; + v383 = arith.sub v381, v382 : i32 #[overflow = wrapping]; + v384 = 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 + v385 = hir.bitcast v384 : ptr; + hir.store v385, v383; + v395 = hir.bitcast v373 : u32; + v396 = arith.zext v395 : u64; + v397 = hir.bitcast v396 : i64; + v377 = arith.constant 0 : i32; + v390 = arith.sub v377, v375 : i32 #[overflow = wrapping]; + v387 = arith.constant -1 : i32; + v386 = arith.add v375, v376 : i32 #[overflow = wrapping]; + v388 = arith.add v386, v387 : i32 #[overflow = wrapping]; + v391 = arith.band v388, v390 : i32; + v392 = hir.bitcast v391 : u32; + v393 = arith.zext v392 : u64; + v394 = hir.bitcast v393 : i64; + v398 = arith.mul v394, v397 : i64 #[overflow = wrapping]; + v848 = arith.constant 0 : i32; + v399 = arith.constant 32 : i64; + v401 = hir.cast v399 : u32; + v400 = hir.bitcast v398 : u64; + v402 = arith.shr v400, v401 : u64; + v403 = hir.bitcast v402 : i64; + v404 = arith.trunc v403 : i32; + v406 = arith.neq v404, v848 : i1; + v760, v761, v762, v763, v764, v765 = scf.if v406 : i32, i32, i32, i32, i32, u32 { ^block110: - v747 = arith.constant 0 : u32; - v754 = ub.poison i32 : i32; - scf.yield v374, v385, v754, v754, v754, v747; + v745 = arith.constant 0 : u32; + v752 = ub.poison i32 : i32; + scf.yield v372, v383, v752, v752, v752, v745; } else { ^block58: - v409 = arith.trunc v400 : i32; - v849 = arith.constant 0 : i32; - v410 = arith.constant -2147483648 : i32; - v411 = arith.sub v410, v377 : i32 #[overflow = wrapping]; - v413 = hir.bitcast v411 : u32; - v412 = hir.bitcast v409 : u32; - v414 = arith.lte v412, v413 : i1; - v415 = arith.zext v414 : u32; - v416 = hir.bitcast v415 : i32; - v418 = arith.neq v416, v849 : i1; - v810 = scf.if v418 : i32 { + v407 = arith.trunc v398 : i32; + v847 = arith.constant 0 : i32; + v408 = arith.constant -2147483648 : i32; + v409 = arith.sub v408, v375 : i32 #[overflow = wrapping]; + v411 = hir.bitcast v409 : u32; + v410 = hir.bitcast v407 : u32; + v412 = arith.lte v410, v411 : i1; + v413 = arith.zext v412 : u32; + v414 = hir.bitcast v413 : i32; + v416 = arith.neq v414, v847 : i1; + v808 = scf.if v416 : i32 { ^block56: - v848 = arith.constant 0 : i32; - v429 = arith.neq v409, v848 : i1; - v809 = scf.if v429 : i32 { + v846 = arith.constant 0 : i32; + v427 = arith.neq v407, v846 : i1; + v807 = scf.if v427 : i32 { ^block60: - v847 = arith.constant 0 : i32; - v445 = arith.neq v376, v847 : i1; - v808 = scf.if v445 : i32 { + v845 = arith.constant 0 : i32; + v443 = arith.neq v374, v845 : i1; + v806 = scf.if v443 : i32 { ^block63: - v427 = 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::alloc::Global::alloc_impl(v385, v377, v409, v427) - v456 = hir.bitcast v385 : u32; - v501 = arith.constant 4 : u32; - v458 = arith.mod v456, v501 : u32; - hir.assertz v458 #[code = 250]; - v459 = hir.int_to_ptr v456 : ptr; - v460 = hir.load v459 : i32; - scf.yield v460; + v425 = 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::alloc::Global::alloc_impl(v383, v375, v407, v425) + v454 = hir.bitcast v383 : u32; + v499 = arith.constant 4 : u32; + v456 = arith.mod v454, v499 : u32; + hir.assertz v456 #[code = 250]; + v457 = hir.int_to_ptr v454 : ptr; + v458 = hir.load v457 : i32; + scf.yield v458; } else { ^block64: - v446 = arith.constant 8 : i32; - v447 = arith.add v385, v446 : 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(v447, v377, v409) - v431 = arith.constant 8 : u32; - v448 = hir.bitcast v385 : u32; - v450 = arith.add v448, v431 : u32 #[overflow = checked]; - v846 = arith.constant 4 : u32; - v452 = arith.mod v450, v846 : u32; - hir.assertz v452 #[code = 250]; - v453 = hir.int_to_ptr v450 : ptr; - v454 = hir.load v453 : i32; - scf.yield v454; + v444 = arith.constant 8 : i32; + v445 = arith.add v383, v444 : 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(v445, v375, v407) + v429 = arith.constant 8 : u32; + v446 = hir.bitcast v383 : u32; + v448 = arith.add v446, v429 : u32 #[overflow = checked]; + v844 = arith.constant 4 : u32; + v450 = arith.mod v448, v844 : u32; + hir.assertz v450 #[code = 250]; + v451 = hir.int_to_ptr v448 : ptr; + v452 = hir.load v451 : i32; + scf.yield v452; }; - v844 = arith.constant 0 : i32; - v845 = arith.constant 0 : i32; - v463 = arith.eq v808, v845 : i1; - v464 = arith.zext v463 : u32; - v465 = hir.bitcast v464 : i32; - v467 = arith.neq v465, v844 : i1; - scf.if v467{ + v842 = arith.constant 0 : i32; + v843 = arith.constant 0 : i32; + v461 = arith.eq v806, v843 : i1; + v462 = arith.zext v461 : u32; + v463 = hir.bitcast v462 : i32; + v465 = arith.neq v463, v842 : i1; + scf.if v465{ ^block65: - v843 = arith.constant 8 : u32; - v484 = hir.bitcast v374 : u32; - v486 = arith.add v484, v843 : u32 #[overflow = checked]; - v842 = arith.constant 4 : u32; - v488 = arith.mod v486, v842 : u32; - hir.assertz v488 #[code = 250]; - v489 = hir.int_to_ptr v486 : ptr; - hir.store v489, v409; - v841 = arith.constant 4 : u32; - v491 = hir.bitcast v374 : u32; - v493 = arith.add v491, v841 : u32 #[overflow = checked]; + v841 = arith.constant 8 : u32; + v482 = hir.bitcast v372 : u32; + v484 = arith.add v482, v841 : u32 #[overflow = checked]; v840 = arith.constant 4 : u32; - v495 = arith.mod v493, v840 : u32; - hir.assertz v495 #[code = 250]; - v496 = hir.int_to_ptr v493 : ptr; - hir.store v496, v377; + v486 = arith.mod v484, v840 : u32; + hir.assertz v486 #[code = 250]; + v487 = hir.int_to_ptr v484 : ptr; + hir.store v487, v407; + v839 = arith.constant 4 : u32; + v489 = hir.bitcast v372 : u32; + v491 = arith.add v489, v839 : u32 #[overflow = checked]; + v838 = arith.constant 4 : u32; + v493 = arith.mod v491, v838 : u32; + hir.assertz v493 #[code = 250]; + v494 = hir.int_to_ptr v491 : ptr; + hir.store v494, v375; scf.yield ; } else { ^block66: - v839 = arith.constant 8 : u32; - v469 = hir.bitcast v374 : u32; - v471 = arith.add v469, v839 : u32 #[overflow = checked]; - v838 = arith.constant 4 : u32; - v473 = arith.mod v471, v838 : u32; - hir.assertz v473 #[code = 250]; - v474 = hir.int_to_ptr v471 : ptr; - hir.store v474, v808; - v837 = arith.constant 4 : u32; - v476 = hir.bitcast v374 : u32; - v478 = arith.add v476, v837 : u32 #[overflow = checked]; + v837 = arith.constant 8 : u32; + v467 = hir.bitcast v372 : u32; + v469 = arith.add v467, v837 : u32 #[overflow = checked]; v836 = arith.constant 4 : u32; - v480 = arith.mod v478, v836 : u32; - hir.assertz v480 #[code = 250]; - v481 = hir.int_to_ptr v478 : ptr; - hir.store v481, v375; + v471 = arith.mod v469, v836 : u32; + hir.assertz v471 #[code = 250]; + v472 = hir.int_to_ptr v469 : ptr; + hir.store v472, v806; + v835 = arith.constant 4 : u32; + v474 = hir.bitcast v372 : u32; + v476 = arith.add v474, v835 : u32 #[overflow = checked]; + v834 = arith.constant 4 : u32; + v478 = arith.mod v476, v834 : u32; + hir.assertz v478 #[code = 250]; + v479 = hir.int_to_ptr v476 : ptr; + hir.store v479, v373; scf.yield ; }; - v834 = arith.constant 0 : i32; - v835 = arith.constant 1 : i32; - v807 = cf.select v467, v835, v834 : i32; - scf.yield v807; + v832 = arith.constant 0 : i32; + v833 = arith.constant 1 : i32; + v805 = cf.select v465, v833, v832 : i32; + scf.yield v805; } else { ^block61: - v833 = arith.constant 8 : u32; - v430 = hir.bitcast v374 : u32; - v432 = arith.add v430, v833 : u32 #[overflow = checked]; - v832 = arith.constant 4 : u32; - v434 = arith.mod v432, v832 : u32; - hir.assertz v434 #[code = 250]; - v435 = hir.int_to_ptr v432 : ptr; - hir.store v435, v377; - v831 = arith.constant 4 : u32; - v438 = hir.bitcast v374 : u32; - v440 = arith.add v438, v831 : u32 #[overflow = checked]; + v831 = arith.constant 8 : u32; + v428 = hir.bitcast v372 : u32; + v430 = arith.add v428, v831 : u32 #[overflow = checked]; v830 = arith.constant 4 : u32; - v442 = arith.mod v440, v830 : u32; - hir.assertz v442 #[code = 250]; - v829 = arith.constant 0 : i32; - v443 = hir.int_to_ptr v440 : ptr; - hir.store v443, v829; - v828 = arith.constant 0 : i32; - scf.yield v828; + v432 = arith.mod v430, v830 : u32; + hir.assertz v432 #[code = 250]; + v433 = hir.int_to_ptr v430 : ptr; + hir.store v433, v375; + v829 = arith.constant 4 : u32; + v436 = hir.bitcast v372 : u32; + v438 = arith.add v436, v829 : u32 #[overflow = checked]; + v828 = arith.constant 4 : u32; + v440 = arith.mod v438, v828 : u32; + hir.assertz v440 #[code = 250]; + v827 = arith.constant 0 : i32; + v441 = hir.int_to_ptr v438 : ptr; + hir.store v441, v827; + v826 = arith.constant 0 : i32; + scf.yield v826; }; - scf.yield v809; + scf.yield v807; } else { ^block59: - v827 = ub.poison i32 : i32; - scf.yield v827; + v825 = ub.poison i32 : i32; + scf.yield v825; }; - v822 = arith.constant 0 : u32; - v755 = arith.constant 1 : u32; - v815 = cf.select v418, v755, v822 : u32; + v820 = arith.constant 0 : u32; + v753 = arith.constant 1 : u32; + v813 = cf.select v416, v753, v820 : u32; + v821 = ub.poison i32 : i32; + v812 = cf.select v416, v383, v821 : i32; + v822 = ub.poison i32 : i32; + v811 = cf.select v416, v372, v822 : i32; v823 = ub.poison i32 : i32; - v814 = cf.select v418, v385, v823 : i32; + v810 = cf.select v416, v823, v383 : i32; v824 = ub.poison i32 : i32; - v813 = cf.select v418, v374, v824 : i32; - v825 = ub.poison i32 : i32; - v812 = cf.select v418, v825, v385 : i32; - v826 = ub.poison i32 : i32; - v811 = cf.select v418, v826, v374 : i32; - scf.yield v811, v812, v813, v810, v814, v815; + v809 = cf.select v416, v824, v372 : i32; + scf.yield v809, v810, v811, v808, v812, v813; }; - v768, v769, v770 = scf.index_switch v767 : i32, i32, i32 + v766, v767, v768 = scf.index_switch v765 : i32, i32, i32 case 0 { ^block57: - v821 = arith.constant 4 : u32; - v421 = hir.bitcast v762 : u32; - v423 = arith.add v421, v821 : u32 #[overflow = checked]; - v820 = arith.constant 4 : u32; - v425 = arith.mod v423, v820 : u32; - hir.assertz v425 #[code = 250]; - v819 = arith.constant 0 : i32; - v426 = hir.int_to_ptr v423 : ptr; - hir.store v426, v819; - v818 = arith.constant 1 : i32; - scf.yield v762, v818, v763; + v819 = arith.constant 4 : u32; + v419 = hir.bitcast v760 : u32; + v421 = arith.add v419, v819 : u32 #[overflow = checked]; + v818 = arith.constant 4 : u32; + v423 = arith.mod v421, v818 : u32; + hir.assertz v423 #[code = 250]; + v817 = arith.constant 0 : i32; + v424 = hir.int_to_ptr v421 : ptr; + hir.store v424, v817; + v816 = arith.constant 1 : i32; + scf.yield v760, v816, v761; } default { ^block114: - scf.yield v764, v765, v766; + scf.yield v762, v763, v764; }; - v500 = hir.bitcast v768 : u32; - v817 = arith.constant 4 : u32; - v502 = arith.mod v500, v817 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - hir.store v503, v769; - v816 = arith.constant 16 : i32; - v508 = arith.add v770, v816 : i32 #[overflow = wrapping]; - v509 = 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 - v510 = hir.bitcast v509 : ptr; - hir.store v510, v508; + v498 = hir.bitcast v766 : u32; + v815 = arith.constant 4 : u32; + v500 = arith.mod v498, v815 : u32; + hir.assertz v500 #[code = 250]; + v501 = hir.int_to_ptr v498 : ptr; + hir.store v501, v767; + v814 = arith.constant 16 : i32; + v506 = arith.add v768, v814 : i32 #[overflow = wrapping]; + v507 = 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 + v508 = hir.bitcast v507 : ptr; + hir.store v508, v506; builtin.ret ; }; - private builtin.function @::allocate(v511: i32, v512: i32, v513: i32) { - ^block67(v511: i32, v512: i32, v513: i32): - v515 = 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 - v516 = hir.bitcast v515 : ptr; - v517 = hir.load v516 : i32; - v518 = arith.constant 16 : i32; - v519 = arith.sub v517, v518 : i32 #[overflow = wrapping]; - v520 = 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 - v521 = hir.bitcast v520 : ptr; - hir.store v521, v519; - v514 = arith.constant 0 : i32; - v522 = arith.constant 8 : i32; - v523 = arith.add v519, v522 : 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::alloc::Global::alloc_impl(v523, v512, v513, v514) - v526 = arith.constant 12 : u32; - v525 = hir.bitcast v519 : u32; - v527 = arith.add v525, v526 : u32 #[overflow = checked]; - v528 = arith.constant 4 : u32; - v529 = arith.mod v527, v528 : u32; - hir.assertz v529 #[code = 250]; - v530 = hir.int_to_ptr v527 : ptr; - v531 = hir.load v530 : i32; - v533 = arith.constant 8 : u32; - v532 = hir.bitcast v519 : u32; - v534 = arith.add v532, v533 : u32 #[overflow = checked]; - v855 = arith.constant 4 : u32; - v536 = arith.mod v534, v855 : u32; - hir.assertz v536 #[code = 250]; - v537 = hir.int_to_ptr v534 : ptr; - v538 = hir.load v537 : i32; - v539 = hir.bitcast v511 : u32; - v854 = arith.constant 4 : u32; - v541 = arith.mod v539, v854 : u32; - hir.assertz v541 #[code = 250]; - v542 = hir.int_to_ptr v539 : ptr; - hir.store v542, v538; + private builtin.function @::allocate(v509: i32, v510: i32, v511: i32) { + ^block67(v509: i32, v510: i32, v511: i32): + v513 = 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 + v514 = hir.bitcast v513 : ptr; + v515 = hir.load v514 : i32; + v516 = arith.constant 16 : i32; + v517 = arith.sub v515, v516 : i32 #[overflow = wrapping]; + v518 = 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 + v519 = hir.bitcast v518 : ptr; + hir.store v519, v517; + v512 = arith.constant 0 : i32; + v520 = arith.constant 8 : i32; + v521 = arith.add v517, v520 : 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::alloc::Global::alloc_impl(v521, v510, v511, v512) + v524 = arith.constant 12 : u32; + v523 = hir.bitcast v517 : 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 : i32; + v531 = arith.constant 8 : u32; + v530 = hir.bitcast v517 : u32; + v532 = arith.add v530, v531 : u32 #[overflow = checked]; v853 = arith.constant 4 : u32; - v543 = hir.bitcast v511 : u32; - v545 = arith.add v543, v853 : u32 #[overflow = checked]; + v534 = arith.mod v532, v853 : u32; + hir.assertz v534 #[code = 250]; + v535 = hir.int_to_ptr v532 : ptr; + v536 = hir.load v535 : i32; + v537 = hir.bitcast v509 : u32; v852 = arith.constant 4 : u32; - v547 = arith.mod v545, v852 : u32; - hir.assertz v547 #[code = 250]; - v548 = hir.int_to_ptr v545 : ptr; - hir.store v548, v531; - v851 = arith.constant 16 : i32; - v550 = arith.add v519, v851 : i32 #[overflow = wrapping]; - v551 = 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 - v552 = hir.bitcast v551 : ptr; - hir.store v552, v550; + v539 = arith.mod v537, v852 : u32; + hir.assertz v539 #[code = 250]; + v540 = hir.int_to_ptr v537 : ptr; + hir.store v540, v536; + v851 = arith.constant 4 : u32; + v541 = hir.bitcast v509 : u32; + v543 = arith.add v541, v851 : u32 #[overflow = checked]; + v850 = arith.constant 4 : u32; + v545 = arith.mod v543, v850 : u32; + hir.assertz v545 #[code = 250]; + v546 = hir.int_to_ptr v543 : ptr; + hir.store v546, v529; + v849 = arith.constant 16 : i32; + v548 = arith.add v517, v849 : i32 #[overflow = wrapping]; + v549 = 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 + v550 = hir.bitcast v549 : ptr; + hir.store v550, v548; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v553: i32, v554: i32, v555: i32, v556: i32) { - ^block69(v553: i32, v554: i32, v555: i32, v556: i32): - v871 = arith.constant 0 : i32; - v557 = arith.constant 0 : i32; - v558 = arith.eq v555, v557 : i1; - v559 = arith.zext v558 : u32; - v560 = hir.bitcast v559 : i32; - v562 = arith.neq v560, v871 : i1; - v867 = scf.if v562 : i32 { + private builtin.function @alloc::alloc::Global::alloc_impl(v551: i32, v552: i32, v553: i32, v554: i32) { + ^block69(v551: i32, v552: i32, v553: i32, v554: i32): + v869 = arith.constant 0 : i32; + v555 = arith.constant 0 : i32; + v556 = arith.eq v553, v555 : i1; + v557 = arith.zext v556 : u32; + v558 = hir.bitcast v557 : i32; + v560 = arith.neq v558, v869 : i1; + v865 = scf.if v560 : i32 { ^block117: - scf.yield v554; + scf.yield v552; } else { ^block72: 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() - v870 = arith.constant 0 : i32; - v564 = arith.neq v556, v870 : i1; - v866 = scf.if v564 : i32 { + v868 = arith.constant 0 : i32; + v562 = arith.neq v554, v868 : i1; + v864 = scf.if v562 : i32 { ^block73: - v566 = 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(v555, v554) : i32 - scf.yield v566; + v564 = 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(v553, v552) : i32 + scf.yield v564; } else { ^block74: - v565 = 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(v555, v554) : i32 - scf.yield v565; + v563 = 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(v553, v552) : i32 + scf.yield v563; }; - scf.yield v866; + scf.yield v864; }; - v570 = arith.constant 4 : u32; - v569 = hir.bitcast v553 : u32; - v571 = arith.add v569, v570 : u32 #[overflow = checked]; - v869 = arith.constant 4 : u32; - v573 = arith.mod v571, v869 : u32; - hir.assertz v573 #[code = 250]; - v574 = hir.int_to_ptr v571 : ptr; - hir.store v574, v555; - v576 = hir.bitcast v553 : u32; - v868 = arith.constant 4 : u32; - v578 = arith.mod v576, v868 : u32; - hir.assertz v578 #[code = 250]; - v579 = hir.int_to_ptr v576 : ptr; - hir.store v579, v867; + v568 = arith.constant 4 : u32; + v567 = hir.bitcast v551 : u32; + v569 = arith.add v567, v568 : u32 #[overflow = checked]; + v867 = arith.constant 4 : u32; + v571 = arith.mod v569, v867 : u32; + hir.assertz v571 #[code = 250]; + v572 = hir.int_to_ptr v569 : ptr; + hir.store v572, v553; + v574 = hir.bitcast v551 : u32; + v866 = arith.constant 4 : u32; + v576 = arith.mod v574, v866 : u32; + hir.assertz v576 #[code = 250]; + v577 = hir.int_to_ptr v574 : ptr; + hir.store v577, v865; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v580: i32, v581: i32, v582: i32, v583: i32) { - ^block75(v580: i32, v581: i32, v582: i32, v583: i32): - v897 = arith.constant 0 : i32; - v584 = arith.constant 0 : i32; - v588 = arith.eq v583, v584 : i1; - v589 = arith.zext v588 : u32; - v590 = hir.bitcast v589 : i32; - v592 = arith.neq v590, v897 : i1; - v884, v885 = scf.if v592 : i32, i32 { + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v578: i32, v579: i32, v580: i32, v581: i32) { + ^block75(v578: i32, v579: i32, v580: i32, v581: i32): + v895 = arith.constant 0 : i32; + v582 = arith.constant 0 : i32; + v586 = arith.eq v581, v582 : i1; + v587 = arith.zext v586 : u32; + v588 = hir.bitcast v587 : i32; + v590 = arith.neq v588, v895 : i1; + v882, v883 = scf.if v590 : i32, i32 { ^block121: - v896 = arith.constant 0 : i32; - v586 = arith.constant 4 : i32; - scf.yield v586, v896; + v894 = arith.constant 0 : i32; + v584 = arith.constant 4 : i32; + scf.yield v584, v894; } else { ^block78: - v593 = hir.bitcast v581 : u32; - v628 = arith.constant 4 : u32; - v595 = arith.mod v593, v628 : u32; - hir.assertz v595 #[code = 250]; - v596 = hir.int_to_ptr v593 : ptr; - v597 = hir.load v596 : i32; - v894 = arith.constant 0 : i32; - v895 = arith.constant 0 : i32; - v599 = arith.eq v597, v895 : i1; - v600 = arith.zext v599 : u32; - v601 = hir.bitcast v600 : i32; - v603 = arith.neq v601, v894 : i1; - v882 = scf.if v603 : i32 { + v591 = hir.bitcast v579 : u32; + v626 = arith.constant 4 : u32; + v593 = arith.mod v591, v626 : u32; + hir.assertz v593 #[code = 250]; + v594 = hir.int_to_ptr v591 : ptr; + v595 = hir.load v594 : i32; + v892 = arith.constant 0 : i32; + v893 = arith.constant 0 : i32; + v597 = arith.eq v595, v893 : i1; + v598 = arith.zext v597 : u32; + v599 = hir.bitcast v598 : i32; + v601 = arith.neq v599, v892 : i1; + v880 = scf.if v601 : i32 { ^block120: - v893 = arith.constant 0 : i32; - scf.yield v893; + v891 = arith.constant 0 : i32; + scf.yield v891; } else { ^block79: - v892 = arith.constant 4 : u32; - v604 = hir.bitcast v580 : u32; - v606 = arith.add v604, v892 : u32 #[overflow = checked]; - v891 = arith.constant 4 : u32; - v608 = arith.mod v606, v891 : u32; - hir.assertz v608 #[code = 250]; - v609 = hir.int_to_ptr v606 : ptr; - hir.store v609, v582; v890 = arith.constant 4 : u32; - v610 = hir.bitcast v581 : u32; - v612 = arith.add v610, v890 : u32 #[overflow = checked]; + v602 = hir.bitcast v578 : u32; + v604 = arith.add v602, v890 : u32 #[overflow = checked]; v889 = arith.constant 4 : u32; - v614 = arith.mod v612, v889 : u32; - hir.assertz v614 #[code = 250]; - v615 = hir.int_to_ptr v612 : ptr; - v616 = hir.load v615 : i32; - v617 = hir.bitcast v580 : u32; + v606 = arith.mod v604, v889 : u32; + hir.assertz v606 #[code = 250]; + v607 = hir.int_to_ptr v604 : ptr; + hir.store v607, v580; v888 = arith.constant 4 : u32; - v619 = arith.mod v617, v888 : u32; - hir.assertz v619 #[code = 250]; - v620 = hir.int_to_ptr v617 : ptr; - hir.store v620, v616; - v621 = arith.mul v597, v583 : i32 #[overflow = wrapping]; - scf.yield v621; + v608 = hir.bitcast v579 : u32; + v610 = arith.add v608, v888 : u32 #[overflow = checked]; + v887 = arith.constant 4 : u32; + v612 = arith.mod v610, v887 : u32; + hir.assertz v612 #[code = 250]; + v613 = hir.int_to_ptr v610 : ptr; + v614 = hir.load v613 : i32; + v615 = hir.bitcast v578 : u32; + v886 = arith.constant 4 : u32; + v617 = arith.mod v615, v886 : u32; + hir.assertz v617 #[code = 250]; + v618 = hir.int_to_ptr v615 : ptr; + hir.store v618, v614; + v619 = arith.mul v595, v581 : i32 #[overflow = wrapping]; + scf.yield v619; }; - v622 = arith.constant 8 : i32; - v887 = arith.constant 4 : i32; - v883 = cf.select v603, v887, v622 : i32; - scf.yield v883, v882; + v620 = arith.constant 8 : i32; + v885 = arith.constant 4 : i32; + v881 = cf.select v601, v885, v620 : i32; + scf.yield v881, v880; }; - v625 = arith.add v580, v884 : i32 #[overflow = wrapping]; - v627 = hir.bitcast v625 : u32; - v886 = arith.constant 4 : u32; - v629 = arith.mod v627, v886 : u32; - hir.assertz v629 #[code = 250]; - v630 = hir.int_to_ptr v627 : ptr; - hir.store v630, v885; + v623 = arith.add v578, v882 : i32 #[overflow = wrapping]; + v625 = hir.bitcast v623 : u32; + v884 = arith.constant 4 : u32; + v627 = arith.mod v625, v884 : u32; + hir.assertz v627 #[code = 250]; + v628 = hir.int_to_ptr v625 : ptr; + hir.store v628, v883; builtin.ret ; }; - private builtin.function @::deallocate(v631: i32, v632: i32, v633: i32) { - ^block80(v631: i32, v632: i32, v633: i32): - v899 = arith.constant 0 : i32; - v634 = arith.constant 0 : i32; - v635 = arith.eq v633, v634 : i1; - v636 = arith.zext v635 : u32; - v637 = hir.bitcast v636 : i32; - v639 = arith.neq v637, v899 : i1; - scf.if v639{ + private builtin.function @::deallocate(v629: i32, v630: i32, v631: i32) { + ^block80(v629: i32, v630: i32, v631: i32): + v897 = arith.constant 0 : i32; + v632 = arith.constant 0 : i32; + v633 = arith.eq v631, v632 : i1; + v634 = arith.zext v633 : u32; + v635 = hir.bitcast v634 : i32; + v637 = arith.neq v635, v897 : i1; + scf.if v637{ ^block82: scf.yield ; } else { ^block83: - 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(v631, v633, v632) + 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(v629, v631, v630) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v640: i32, v641: i32, v642: i32) { - ^block84(v640: i32, v641: i32, v642: i32): + private builtin.function @alloc::raw_vec::handle_error(v638: i32, v639: i32, v640: i32) { + ^block84(v638: i32, v639: i32, v640: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v643: i32, v644: i32) -> i32 { - ^block86(v643: i32, v644: i32): - v651 = arith.constant 0 : i32; - v647 = hir.bitcast v644 : u32; - v646 = hir.bitcast v643 : u32; - v648 = arith.gt v646, v647 : i1; - v649 = arith.zext v648 : u32; - v650 = hir.bitcast v649 : i32; - v652 = arith.neq v650, v651 : i1; - v653 = cf.select v652, v643, v644 : i32; - builtin.ret v653; + private builtin.function @core::ptr::alignment::Alignment::max(v641: i32, v642: i32) -> i32 { + ^block86(v641: i32, v642: i32): + v649 = arith.constant 0 : i32; + v645 = hir.bitcast v642 : u32; + v644 = hir.bitcast v641 : u32; + v646 = arith.gt v644, v645 : i1; + v647 = arith.zext v646 : u32; + v648 = hir.bitcast v647 : i32; + v650 = arith.neq v648, v649 : i1; + v651 = cf.select v650, v641, v642 : i32; + builtin.ret v651; }; - private builtin.function @miden::input_note::get_assets(v654: i32, v655: felt) -> i32 { - ^block88(v654: i32, v655: felt): - v656, v657 = hir.exec @miden/input_note/get_assets(v654, v655) : i32, i32 - builtin.ret v656; + private builtin.function @miden::input_note::get_assets(v652: i32, v653: felt) -> i32 { + ^block88(v652: i32, v653: felt): + v654, v655 = hir.exec @miden/input_note/get_assets(v652, v653) : i32, i32 + builtin.ret v654; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -945,14 +945,14 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f7475706e692f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; - builtin.segment @1048624 = 0x000000220000003f0000002f001000000000000100000001; + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { ^block92: - v659 = 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 v659; + v657 = 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 v657; }; }; \ 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 bbf0f19a8..b6eb2d829 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 @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[3782401883760717684,9295017189735772129,18169115864861297568,15636957763524619456] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.5 + push.3 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278552 + mem_store.278544 push.0 u32assert - mem_store.278553 + mem_store.278545 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 @@ -45,7 +45,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -53,7 +53,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048648 + push.1048612 u32wrapping_add movup.2 swap.1 @@ -73,7 +73,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -81,7 +81,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048648 + push.1048612 u32wrapping_add dup.1 swap.2 @@ -167,7 +167,7 @@ end proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding( ) -> felt - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -177,7 +177,7 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -243,7 +243,7 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets push.16 movup.2 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -264,7 +264,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -272,7 +272,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048652 + push.1048616 u32wrapping_add u32divmod.4 swap.1 @@ -293,7 +293,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -307,7 +307,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048652 + push.1048616 movup.2 u32wrapping_add u32divmod.4 @@ -526,8 +526,8 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc alloc::vec::Vec::with_capacity(i32, i32) - push.1114208 +proc alloc::vec::Vec::with_capacity(i32) + push.1114176 u32divmod.4 swap.1 trace.240 @@ -537,7 +537,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -552,9 +552,6 @@ proc alloc::vec::Vec::with_capacity(i32, i32) dup.2 u32wrapping_add dup.1 - movup.3 - swap.5 - movdn.3 swap.2 swap.1 trace.240 @@ -563,7 +560,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) trace.252 nop push.8 - dup.2 + dup.1 add u32assert push.8 @@ -580,7 +577,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) trace.252 nop push.8 - dup.3 + dup.4 add u32assert push.4 @@ -598,7 +595,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + movup.3 push.4 dup.1 swap.1 @@ -614,7 +611,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -626,12 +623,11 @@ end @callconv("C") proc alloc::raw_vec::RawVecInner::with_capacity_in( - i32, i32, i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -641,7 +637,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -707,8 +703,6 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( neq neq if.true - movup.3 - drop push.12 dup.2 add @@ -759,7 +753,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -770,8 +764,16 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( else movup.2 drop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + movup.3 add u32assert push.4 @@ -787,7 +789,10 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 + push.1048596 + movup.2 + u32wrapping_add + 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::raw_vec::handle_error @@ -803,7 +808,7 @@ proc miden_base_sys::bindings::input_note::get_assets( i32, felt ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -813,7 +818,7 @@ proc miden_base_sys::bindings::input_note::get_assets( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -823,18 +828,8 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop - push.1114212 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048632 - u32wrapping_add push.4 - dup.2 + dup.1 u32wrapping_add trace.240 nop @@ -918,7 +913,7 @@ proc miden_base_sys::bindings::input_note::get_assets( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -939,7 +934,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -949,7 +944,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1040,7 +1035,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1058,7 +1053,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1068,7 +1063,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1453,7 +1448,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1469,7 +1464,7 @@ proc ::allocate( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1479,7 +1474,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1572,7 +1567,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 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 af3e5dd85..ebdf3dafe 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 @@ -13,11 +13,11 @@ (type (;3;) (func (result f32))) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) - (type (;6;) (func (param 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 (;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 i32))) + (type (;10;) (func (param i32 i32 i32 i32))) (type (;11;) (func (param i32 f32) (result i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -29,7 +29,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048648 + i32.const 1048612 i32.add local.get 1 local.get 0 @@ -39,7 +39,7 @@ (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 1048648 + i32.const 1048612 i32.add local.get 1 local.get 0 @@ -95,7 +95,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048652 + i32.const 1048616 i32.add i32.load8_u br_if 0 (;@1;) @@ -103,7 +103,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048652 + i32.const 1048616 i32.add i32.const 1 i32.store8 @@ -184,42 +184,41 @@ (func $intrinsics::mem::heap_base (;9;) (type 5) (result i32) unreachable ) - (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32 i32) + (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32) (local i32 i64) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 2 + local.tee 1 global.set $__stack_pointer - local.get 2 + local.get 1 i32.const 8 i32.add i32.const 16 i32.const 16 - local.get 1 call $alloc::raw_vec::RawVecInner::with_capacity_in - local.get 2 + local.get 1 i64.load offset=8 - local.set 3 + local.set 2 local.get 0 i32.const 0 i32.store offset=8 local.get 0 - local.get 3 - i64.store align=4 local.get 2 + i64.store align=4 + local.get 1 i32.const 16 i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 7) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 4 + local.tee 3 global.set $__stack_pointer - local.get 4 + local.get 3 i32.const 4 i32.add i32.const 256 @@ -227,35 +226,39 @@ local.get 1 local.get 2 call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 4 + local.get 3 i32.load offset=8 local.set 2 block ;; label = @1 - local.get 4 + local.get 3 i32.load offset=4 i32.const 1 i32.ne br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 local.get 2 - local.get 4 - i32.load offset=12 local.get 3 + i32.load offset=12 + local.get 0 + i32.const 1048596 + i32.add call $alloc::raw_vec::handle_error unreachable end local.get 0 - local.get 4 + local.get 3 i32.load offset=12 i32.store offset=4 local.get 0 local.get 2 i32.store - local.get 4 + local.get 3 i32.const 16 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::input_note::get_assets (;12;) (type 8) (param i32 f32) + (func $miden_base_sys::bindings::input_note::get_assets (;12;) (type 7) (param i32 f32) (local i32) global.get $__stack_pointer i32.const 16 @@ -265,9 +268,6 @@ local.get 2 i32.const 4 i32.add - global.get $GOT.data.internal.__memory_base - i32.const 1048632 - i32.add call $alloc::vec::Vec::with_capacity local.get 0 i32.const 8 @@ -288,7 +288,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;13;) (type 9) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;13;) (type 8) (param i32) (result f32) unreachable ) (func $alloc::raw_vec::RawVecInner::deallocate (;14;) (type 2) (param i32 i32 i32) @@ -323,7 +323,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 10) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -464,7 +464,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;17;) (type 7) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;17;) (type 10) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -491,7 +491,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 7) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 10) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -551,8 +551,8 @@ (func $miden::input_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/input_note.rs\00") - (data $.data (;1;) (i32.const 1048624) "\01\00\00\00\01\00\00\00\00\00\10\00/\00\00\00?\00\00\00\22\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\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\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "felt" (type (;1;))) 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 f2e4e9b1b..9531a3cae 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,7 +10,7 @@ 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 1048652 : i32; + v6 = arith.constant 1048612 : 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; @@ -26,36 +26,36 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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 1048652 : i32; + v18 = arith.constant 1048612 : 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 - v668 = arith.constant 0 : i32; + v666 = 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, v668 : i1; + v26 = arith.neq v24, v666 : i1; scf.if v26{ ^block13: scf.yield ; } else { ^block14: - v666 = arith.constant 0 : i32; - v667 = arith.constant 0 : i32; - v28 = arith.eq v12, v667 : i1; + v664 = arith.constant 0 : i32; + v665 = arith.constant 0 : i32; + v28 = arith.eq v12, v665 : i1; v29 = arith.zext v28 : u32; v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v666 : i1; + v32 = arith.neq v30, v664 : i1; scf.if v32{ ^block94: scf.yield ; } else { ^block15: - v660 = arith.constant 0 : u8; + v658 = 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, v660; + hir.mem_set v37, v35, v658; scf.yield ; }; scf.yield ; @@ -93,12 +93,12 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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 - v670 = arith.constant 16 : i32; - v671 = arith.constant 4 : i32; - v62 = arith.add v46, v671 : 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::raw_vec::RawVecInner::deallocate(v62, v670, v670) - v669 = arith.constant 16 : i32; - v66 = arith.add v46, v669 : i32 #[overflow = wrapping]; + v668 = arith.constant 16 : i32; + v669 = arith.constant 4 : i32; + v62 = arith.add v46, v669 : 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::raw_vec::RawVecInner::deallocate(v62, v668, v668) + v667 = arith.constant 16 : i32; + v66 = arith.add v46, v667 : 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; @@ -115,7 +115,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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 1048656 : i32; + v73 = arith.constant 1048616 : i32; v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; v75 = hir.bitcast v74 : u32; v76 = hir.int_to_ptr v75 : ptr; @@ -133,12 +133,12 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v83 = hir.bitcast v82 : ptr; v84 = hir.load v83 : 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/__wasm_call_ctors() - v673 = arith.constant 1 : u8; - v675 = arith.constant 1048656 : i32; - v86 = arith.add v84, v675 : i32 #[overflow = wrapping]; + v671 = arith.constant 1 : u8; + v673 = arith.constant 1048616 : i32; + v86 = arith.add v84, v673 : i32 #[overflow = wrapping]; v90 = hir.bitcast v86 : u32; v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v673; + hir.store v91, v671; scf.yield ; }; builtin.ret ; @@ -148,27 +148,27 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- ^block26(v92: i32, v93: i32, v94: i32): v97 = arith.constant 16 : i32; v96 = arith.constant 0 : i32; - v677 = arith.constant 16 : u32; + v675 = arith.constant 16 : u32; v99 = hir.bitcast v93 : u32; - v101 = arith.gt v99, v677 : i1; + v101 = arith.gt v99, v675 : i1; v102 = arith.zext v101 : u32; v103 = hir.bitcast v102 : i32; v105 = arith.neq v103, v96 : i1; v106 = cf.select v105, v93, v97 : i32; - v717 = arith.constant 0 : i32; + v715 = 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, v717 : i1; - v686, v687 = scf.if v111 : i32, u32 { + v111 = arith.neq v109, v715 : i1; + v684, v685 = scf.if v111 : i32, u32 { ^block100: - v678 = arith.constant 0 : u32; - v682 = ub.poison i32 : i32; - scf.yield v682, v678; + v676 = arith.constant 0 : u32; + v680 = ub.poison i32 : i32; + scf.yield v680, v676; } 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/core::ptr::alignment::Alignment::max(v93, v106) : i32 - v716 = arith.constant 0 : i32; + v714 = arith.constant 0 : i32; v112 = arith.constant -2147483648 : i32; v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; v116 = hir.bitcast v114 : u32; @@ -176,18 +176,18 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v117 = arith.gt v115, v116 : i1; v118 = arith.zext v117 : u32; v119 = hir.bitcast v118 : i32; - v121 = arith.neq v119, v716 : i1; - v701 = scf.if v121 : i32 { + v121 = arith.neq v119, v714 : i1; + v699 = scf.if v121 : i32 { ^block99: - v715 = ub.poison i32 : i32; - scf.yield v715; + v713 = ub.poison i32 : i32; + scf.yield v713; } else { ^block30: - v713 = arith.constant 0 : i32; - v127 = arith.sub v713, v113 : i32 #[overflow = wrapping]; - v714 = arith.constant -1 : i32; + v711 = arith.constant 0 : i32; + v127 = arith.sub v711, v113 : i32 #[overflow = wrapping]; + v712 = arith.constant -1 : i32; v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; - v125 = arith.add v123, v714 : i32 #[overflow = wrapping]; + v125 = arith.add v123, v712 : i32 #[overflow = wrapping]; v128 = arith.band v125, v127 : i32; v129 = hir.bitcast v92 : u32; v130 = arith.constant 4 : u32; @@ -195,8 +195,8 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- hir.assertz v131 #[code = 250]; v132 = hir.int_to_ptr v129 : ptr; v133 = hir.load v132 : i32; - v712 = arith.constant 0 : i32; - v135 = arith.neq v133, v712 : i1; + v710 = arith.constant 0 : i32; + v135 = arith.neq v133, v710 : i1; scf.if v135{ ^block98: scf.yield ; @@ -205,41 +205,41 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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; - v711 = arith.constant 4 : u32; - v145 = arith.mod v143, v711 : u32; + v709 = arith.constant 4 : u32; + v145 = arith.mod v143, v709 : u32; hir.assertz v145 #[code = 250]; - v710 = arith.constant 16 : u32; + v708 = arith.constant 16 : u32; v138 = hir.bitcast v137 : i32; - v141 = arith.shl v138, v710 : i32; + v141 = arith.shl v138, v708 : i32; v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; v146 = hir.int_to_ptr v143 : ptr; hir.store v146, v142; scf.yield ; }; v149 = hir.bitcast v92 : u32; - v709 = arith.constant 4 : u32; - v151 = arith.mod v149, v709 : u32; + v707 = arith.constant 4 : u32; + v151 = arith.mod v149, v707 : u32; hir.assertz v151 #[code = 250]; v152 = hir.int_to_ptr v149 : ptr; v153 = hir.load v152 : i32; - v707 = arith.constant 0 : i32; - v708 = arith.constant -1 : i32; - v155 = arith.bxor v153, v708 : i32; + v705 = arith.constant 0 : i32; + v706 = arith.constant -1 : i32; + v155 = arith.bxor v153, v706 : 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, v707 : i1; - v700 = scf.if v162 : i32 { + v162 = arith.neq v160, v705 : i1; + v698 = scf.if v162 : i32 { ^block33: - v706 = arith.constant 0 : i32; - scf.yield v706; + v704 = arith.constant 0 : i32; + scf.yield v704; } else { ^block34: v164 = hir.bitcast v92 : u32; - v705 = arith.constant 4 : u32; - v166 = arith.mod v164, v705 : u32; + v703 = arith.constant 4 : u32; + v166 = arith.mod v164, v703 : u32; hir.assertz v166 #[code = 250]; v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; v167 = hir.int_to_ptr v164 : ptr; @@ -247,20 +247,20 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; scf.yield v169; }; - scf.yield v700; + scf.yield v698; }; - v683 = arith.constant 1 : u32; - v704 = arith.constant 0 : u32; - v702 = cf.select v121, v704, v683 : u32; - scf.yield v701, v702; + v681 = arith.constant 1 : u32; + v702 = arith.constant 0 : u32; + v700 = cf.select v121, v702, v681 : u32; + scf.yield v699, v700; }; - v703 = arith.constant 0 : u32; - v699 = arith.eq v687, v703 : i1; - cf.cond_br v699 ^block28, ^block102(v686); + v701 = arith.constant 0 : u32; + v697 = arith.eq v685, v701 : i1; + cf.cond_br v697 ^block28, ^block102(v684); ^block28: ub.unreachable ; - ^block102(v679: i32): - builtin.ret v679; + ^block102(v677: i32): + builtin.ret v677; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -269,672 +269,672 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- builtin.ret v172; }; - private builtin.function @alloc::vec::Vec::with_capacity(v174: i32, v175: i32) { - ^block39(v174: i32, v175: i32): - v178 = 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 - v179 = hir.bitcast v178 : ptr; - v180 = hir.load v179 : i32; - v181 = arith.constant 16 : i32; - v182 = arith.sub v180, v181 : i32 #[overflow = wrapping]; - v183 = 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 - v184 = hir.bitcast v183 : ptr; - hir.store v184, v182; - v722 = arith.constant 16 : i32; - v185 = arith.constant 8 : i32; - v186 = arith.add v182, v185 : 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::raw_vec::RawVecInner::with_capacity_in(v186, v722, v722, v175) - v190 = arith.constant 8 : u32; - v189 = hir.bitcast v182 : u32; - v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v721 = arith.constant 8 : u32; - v193 = arith.mod v191, v721 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - v195 = hir.load v194 : i64; - v720 = arith.constant 8 : u32; - v197 = hir.bitcast v174 : u32; - v199 = arith.add v197, v720 : u32 #[overflow = checked]; - v200 = arith.constant 4 : u32; - v201 = arith.mod v199, v200 : u32; - hir.assertz v201 #[code = 250]; - v176 = arith.constant 0 : i32; - v202 = hir.int_to_ptr v199 : ptr; - hir.store v202, v176; - v203 = hir.bitcast v174 : u32; - v719 = arith.constant 4 : u32; - v205 = arith.mod v203, v719 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v195; - v718 = arith.constant 16 : i32; - v208 = arith.add v182, v718 : i32 #[overflow = wrapping]; - v209 = 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 - v210 = hir.bitcast v209 : ptr; - hir.store v210, v208; + private builtin.function @alloc::vec::Vec::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; + v720 = 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/alloc::raw_vec::RawVecInner::with_capacity_in(v185, v720, v720) + v189 = arith.constant 8 : u32; + v188 = hir.bitcast v181 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v719 = arith.constant 8 : u32; + v192 = arith.mod v190, v719 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + v194 = hir.load v193 : i64; + v718 = arith.constant 8 : u32; + v196 = hir.bitcast v174 : u32; + v198 = arith.add v196, v718 : 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; + v717 = arith.constant 4 : u32; + v204 = arith.mod v202, v717 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v194; + v716 = arith.constant 16 : i32; + v207 = arith.add v181, v716 : 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v211: i32, v212: i32, v213: i32, v214: i32) { - ^block41(v211: i32, v212: i32, v213: i32, v214: i32): - v216 = 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 - v217 = hir.bitcast v216 : ptr; - v218 = hir.load v217 : i32; - v219 = arith.constant 16 : i32; - v220 = arith.sub v218, v219 : i32 #[overflow = wrapping]; - v221 = 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 - v222 = hir.bitcast v221 : ptr; - hir.store v222, v220; - v215 = arith.constant 0 : i32; - v225 = arith.constant 256 : i32; - v223 = arith.constant 4 : i32; - v224 = arith.add v220, v223 : 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::raw_vec::RawVecInner::try_allocate_in(v224, v225, v215, v212, v213) - v228 = arith.constant 8 : u32; - v227 = hir.bitcast v220 : u32; - v229 = arith.add v227, v228 : u32 #[overflow = checked]; - v230 = arith.constant 4 : u32; - v231 = arith.mod v229, v230 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : i32; - v733 = arith.constant 4 : u32; - v234 = hir.bitcast v220 : u32; - v236 = arith.add v234, v733 : u32 #[overflow = checked]; - v732 = arith.constant 4 : u32; - v238 = arith.mod v236, v732 : u32; - hir.assertz v238 #[code = 250]; - v239 = hir.int_to_ptr v236 : ptr; - v240 = hir.load v239 : i32; - v731 = arith.constant 0 : i32; - v241 = arith.constant 1 : i32; - v242 = arith.neq v240, v241 : i1; - v243 = arith.zext v242 : u32; - v244 = hir.bitcast v243 : i32; - v246 = arith.neq v244, v731 : i1; - cf.cond_br v246 ^block43, ^block44; - ^block43: - v255 = arith.constant 12 : u32; - v254 = hir.bitcast v220 : u32; - v256 = arith.add v254, v255 : u32 #[overflow = checked]; + private builtin.function @alloc::raw_vec::RawVecInner::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/alloc::raw_vec::RawVecInner::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; + v731 = arith.constant 4 : u32; + v232 = hir.bitcast v218 : u32; + v234 = arith.add v232, v731 : u32 #[overflow = checked]; v730 = arith.constant 4 : u32; - v258 = arith.mod v256, v730 : u32; - hir.assertz v258 #[code = 250]; - v259 = hir.int_to_ptr v256 : ptr; - v260 = hir.load v259 : i32; - v729 = arith.constant 4 : u32; - v261 = hir.bitcast v211 : u32; - v263 = arith.add v261, v729 : u32 #[overflow = checked]; + v236 = arith.mod v234, v730 : u32; + hir.assertz v236 #[code = 250]; + v237 = hir.int_to_ptr v234 : ptr; + v238 = hir.load v237 : i32; + v729 = 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, v729 : i1; + cf.cond_br v244 ^block43, ^block44; + ^block43: + v258 = arith.constant 12 : u32; + v257 = hir.bitcast v218 : u32; + v259 = arith.add v257, v258 : u32 #[overflow = checked]; v728 = arith.constant 4 : u32; - v265 = arith.mod v263, v728 : u32; - hir.assertz v265 #[code = 250]; - v266 = hir.int_to_ptr v263 : ptr; - hir.store v266, v260; - v267 = hir.bitcast v211 : u32; + v261 = arith.mod v259, v728 : u32; + hir.assertz v261 #[code = 250]; + v262 = hir.int_to_ptr v259 : ptr; + v263 = hir.load v262 : i32; v727 = arith.constant 4 : u32; - v269 = arith.mod v267, v727 : u32; - hir.assertz v269 #[code = 250]; - v270 = hir.int_to_ptr v267 : ptr; - hir.store v270, v233; - v726 = arith.constant 16 : i32; - v272 = arith.add v220, v726 : i32 #[overflow = wrapping]; - v273 = 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 - v274 = hir.bitcast v273 : ptr; - hir.store v274, v272; + v264 = hir.bitcast v210 : u32; + v266 = arith.add v264, v727 : u32 #[overflow = checked]; + v726 = arith.constant 4 : u32; + v268 = arith.mod v266, v726 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + hir.store v269, v263; + v270 = hir.bitcast v210 : u32; + v725 = arith.constant 4 : u32; + v272 = arith.mod v270, v725 : u32; + hir.assertz v272 #[code = 250]; + v273 = hir.int_to_ptr v270 : ptr; + hir.store v273, v231; + v724 = arith.constant 16 : i32; + v275 = arith.add v218, v724 : i32 #[overflow = wrapping]; + 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; + hir.store v277, v275; builtin.ret ; ^block44: - v725 = arith.constant 12 : u32; - v247 = hir.bitcast v220 : u32; - v249 = arith.add v247, v725 : u32 #[overflow = checked]; - v724 = arith.constant 4 : u32; - v251 = arith.mod v249, v724 : u32; - hir.assertz v251 #[code = 250]; - v252 = hir.int_to_ptr v249 : ptr; - v253 = hir.load v252 : 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(v233, v253, v214) + v245 = 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 + v246 = hir.bitcast v245 : ptr; + v247 = hir.load v246 : i32; + v723 = arith.constant 12 : u32; + v248 = hir.bitcast v218 : u32; + v250 = arith.add v248, v723 : u32 #[overflow = checked]; + v722 = arith.constant 4 : u32; + v252 = arith.mod v250, v722 : u32; + hir.assertz v252 #[code = 250]; + v253 = hir.int_to_ptr v250 : ptr; + v254 = hir.load v253 : i32; + v255 = arith.constant 1048596 : i32; + v256 = arith.add v247, v255 : 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::raw_vec::handle_error(v231, v254, v256) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::output_note::get_assets(v275: i32, v276: felt) { - ^block45(v275: i32, v276: felt): - v278 = 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 - v279 = hir.bitcast v278 : ptr; - v280 = hir.load v279 : i32; - v281 = arith.constant 16 : i32; - v282 = arith.sub v280, v281 : i32 #[overflow = wrapping]; - v283 = 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 - v284 = hir.bitcast v283 : ptr; - hir.store v284, v282; - v287 = 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 - v288 = hir.bitcast v287 : ptr; - v289 = hir.load v288 : i32; - v290 = arith.constant 1048636 : i32; - v291 = arith.add v289, v290 : i32 #[overflow = wrapping]; - v285 = arith.constant 4 : i32; - v286 = arith.add v282, v285 : 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::vec::Vec::with_capacity(v286, v291) - v295 = arith.constant 8 : u32; - v294 = hir.bitcast v282 : u32; - v296 = arith.add v294, v295 : 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; - v300 = hir.load v299 : i32; - v734 = arith.constant 2 : u32; - v302 = hir.bitcast v300 : u32; - v304 = arith.shr v302, v734 : u32; - v305 = hir.bitcast v304 : i32; - v306 = 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(v305, v276) : i32 - v292 = arith.constant 8 : i32; - v293 = arith.add v275, v292 : i32 #[overflow = wrapping]; - v307 = hir.bitcast v293 : u32; - v739 = arith.constant 4 : u32; - v309 = arith.mod v307, v739 : u32; - hir.assertz v309 #[code = 250]; - v310 = hir.int_to_ptr v307 : ptr; - hir.store v310, v306; - v738 = arith.constant 4 : u32; - v311 = hir.bitcast v282 : u32; - v313 = arith.add v311, v738 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::output_note::get_assets(v278: i32, v279: felt) { + ^block45(v278: i32, v279: felt): + 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; + v283 = hir.load v282 : i32; + v284 = arith.constant 16 : i32; + v285 = arith.sub v283, v284 : i32 #[overflow = wrapping]; + v286 = 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 + v287 = hir.bitcast v286 : ptr; + hir.store v287, v285; + v288 = arith.constant 4 : i32; + v289 = arith.add v285, v288 : 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::vec::Vec::with_capacity(v289) + v293 = arith.constant 8 : u32; + v292 = hir.bitcast v285 : u32; + v294 = arith.add v292, v293 : u32 #[overflow = checked]; + v295 = arith.constant 4 : u32; + v296 = arith.mod v294, v295 : u32; + hir.assertz v296 #[code = 250]; + v297 = hir.int_to_ptr v294 : ptr; + v298 = hir.load v297 : i32; + v732 = arith.constant 2 : u32; + v300 = hir.bitcast v298 : u32; + v302 = arith.shr v300, v732 : u32; + v303 = hir.bitcast v302 : i32; + v304 = 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(v303, v279) : i32 + v290 = arith.constant 8 : i32; + v291 = arith.add v278, v290 : i32 #[overflow = wrapping]; + v305 = hir.bitcast v291 : u32; v737 = arith.constant 4 : u32; - v315 = arith.mod v313, v737 : u32; - hir.assertz v315 #[code = 250]; - v316 = hir.int_to_ptr v313 : ptr; - v317 = hir.load v316 : i64; - v318 = hir.bitcast v275 : u32; + v307 = arith.mod v305, v737 : u32; + hir.assertz v307 #[code = 250]; + v308 = hir.int_to_ptr v305 : ptr; + hir.store v308, v304; v736 = arith.constant 4 : u32; - v320 = arith.mod v318, v736 : u32; - hir.assertz v320 #[code = 250]; - v321 = hir.int_to_ptr v318 : ptr; - hir.store v321, v317; - v735 = arith.constant 16 : i32; - v323 = arith.add v282, v735 : i32 #[overflow = wrapping]; - v324 = 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 - v325 = hir.bitcast v324 : ptr; - hir.store v325, v323; + v309 = hir.bitcast v285 : u32; + v311 = arith.add v309, v736 : u32 #[overflow = checked]; + v735 = arith.constant 4 : u32; + v313 = arith.mod v311, v735 : u32; + hir.assertz v313 #[code = 250]; + v314 = hir.int_to_ptr v311 : ptr; + v315 = hir.load v314 : i64; + v316 = hir.bitcast v278 : u32; + v734 = arith.constant 4 : u32; + v318 = arith.mod v316, v734 : u32; + hir.assertz v318 #[code = 250]; + v319 = hir.int_to_ptr v316 : ptr; + hir.store v319, v315; + v733 = arith.constant 16 : i32; + v321 = arith.add v285, v733 : i32 #[overflow = wrapping]; + v322 = 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 + v323 = hir.bitcast v322 : ptr; + hir.store v323, v321; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v326: i32) -> felt { - ^block47(v326: i32): - v327 = hir.bitcast v326 : felt; - builtin.ret v327; + private builtin.function @intrinsics::felt::from_u32(v324: i32) -> felt { + ^block47(v324: i32): + v325 = hir.bitcast v324 : felt; + builtin.ret v325; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v329: i32, v330: i32, v331: i32) { - ^block49(v329: i32, v330: i32, v331: i32): - v333 = 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 - v334 = hir.bitcast v333 : ptr; - v335 = hir.load v334 : i32; - v336 = arith.constant 16 : i32; - v337 = arith.sub v335, v336 : i32 #[overflow = wrapping]; - v338 = 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 - v339 = hir.bitcast v338 : ptr; - hir.store v339, v337; - v340 = arith.constant 4 : i32; - v341 = arith.add v337, v340 : 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::raw_vec::RawVecInner::current_memory(v341, v329, v330, v331) - v343 = arith.constant 8 : u32; - v342 = hir.bitcast v337 : u32; - v344 = arith.add v342, v343 : u32 #[overflow = checked]; - v345 = arith.constant 4 : u32; - v346 = arith.mod v344, v345 : u32; - hir.assertz v346 #[code = 250]; - v347 = hir.int_to_ptr v344 : ptr; - v348 = hir.load v347 : i32; - v746 = arith.constant 0 : i32; - v332 = arith.constant 0 : i32; - v350 = arith.eq v348, v332 : i1; - v351 = arith.zext v350 : u32; - v352 = hir.bitcast v351 : i32; - v354 = arith.neq v352, v746 : i1; - scf.if v354{ + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v327: i32, v328: i32, v329: i32) { + ^block49(v327: i32, v328: i32, v329: i32): + v331 = 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 + v332 = hir.bitcast v331 : ptr; + v333 = hir.load v332 : i32; + v334 = arith.constant 16 : i32; + v335 = arith.sub v333, v334 : i32 #[overflow = wrapping]; + v336 = 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 + v337 = hir.bitcast v336 : ptr; + hir.store v337, v335; + v338 = arith.constant 4 : i32; + v339 = arith.add v335, v338 : 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::raw_vec::RawVecInner::current_memory(v339, v327, v328, v329) + v341 = arith.constant 8 : u32; + v340 = hir.bitcast v335 : u32; + v342 = arith.add v340, v341 : u32 #[overflow = checked]; + v343 = arith.constant 4 : u32; + v344 = arith.mod v342, v343 : u32; + hir.assertz v344 #[code = 250]; + v345 = hir.int_to_ptr v342 : ptr; + v346 = hir.load v345 : i32; + v744 = arith.constant 0 : i32; + v330 = arith.constant 0 : i32; + v348 = arith.eq v346, v330 : i1; + v349 = arith.zext v348 : u32; + v350 = hir.bitcast v349 : i32; + v352 = arith.neq v350, v744 : i1; + scf.if v352{ ^block108: scf.yield ; } else { ^block52: - v745 = arith.constant 4 : u32; - v355 = hir.bitcast v337 : u32; - v357 = arith.add v355, v745 : u32 #[overflow = checked]; - v744 = arith.constant 4 : u32; - v359 = arith.mod v357, v744 : u32; - hir.assertz v359 #[code = 250]; - v360 = hir.int_to_ptr v357 : ptr; - v361 = hir.load v360 : i32; - v363 = arith.constant 12 : u32; - v362 = hir.bitcast v337 : u32; - v364 = arith.add v362, v363 : u32 #[overflow = checked]; v743 = arith.constant 4 : u32; - v366 = arith.mod v364, v743 : u32; - hir.assertz v366 #[code = 250]; - v367 = hir.int_to_ptr v364 : ptr; - v368 = hir.load v367 : 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(v361, v348, v368) + v353 = hir.bitcast v335 : u32; + v355 = arith.add v353, v743 : u32 #[overflow = checked]; + v742 = arith.constant 4 : u32; + v357 = arith.mod v355, v742 : u32; + hir.assertz v357 #[code = 250]; + v358 = hir.int_to_ptr v355 : ptr; + v359 = hir.load v358 : i32; + v361 = arith.constant 12 : u32; + v360 = hir.bitcast v335 : u32; + v362 = arith.add v360, v361 : u32 #[overflow = checked]; + v741 = arith.constant 4 : u32; + v364 = arith.mod v362, v741 : u32; + hir.assertz v364 #[code = 250]; + v365 = hir.int_to_ptr v362 : ptr; + v366 = hir.load v365 : 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(v359, v346, v366) scf.yield ; }; - v742 = arith.constant 16 : i32; - v371 = arith.add v337, v742 : i32 #[overflow = wrapping]; - v372 = 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 - v373 = hir.bitcast v372 : ptr; - hir.store v373, v371; + v740 = arith.constant 16 : i32; + v369 = arith.add v335, v740 : i32 #[overflow = wrapping]; + v370 = 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 + v371 = hir.bitcast v370 : ptr; + hir.store v371, v369; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32) { - ^block53(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32): - v381 = 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 - v382 = hir.bitcast v381 : ptr; - v383 = hir.load v382 : i32; - v384 = arith.constant 16 : i32; - v385 = arith.sub v383, v384 : i32 #[overflow = wrapping]; - v386 = 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 - v387 = hir.bitcast v386 : ptr; - hir.store v387, v385; - v397 = hir.bitcast v375 : u32; - v398 = arith.zext v397 : u64; - v399 = hir.bitcast v398 : i64; - v379 = arith.constant 0 : i32; - v392 = arith.sub v379, v377 : i32 #[overflow = wrapping]; - v389 = arith.constant -1 : i32; - v388 = arith.add v377, v378 : i32 #[overflow = wrapping]; - v390 = arith.add v388, v389 : i32 #[overflow = wrapping]; - v393 = arith.band v390, v392 : i32; - v394 = hir.bitcast v393 : u32; - v395 = arith.zext v394 : u64; - v396 = hir.bitcast v395 : i64; - v400 = arith.mul v396, v399 : i64 #[overflow = wrapping]; - v850 = arith.constant 0 : i32; - v401 = arith.constant 32 : i64; - v403 = hir.cast v401 : u32; - v402 = hir.bitcast v400 : u64; - v404 = arith.shr v402, v403 : u64; - v405 = hir.bitcast v404 : i64; - v406 = arith.trunc v405 : i32; - v408 = arith.neq v406, v850 : i1; - v762, v763, v764, v765, v766, v767 = scf.if v408 : i32, i32, i32, i32, i32, u32 { + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32) { + ^block53(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32): + v379 = 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 + v380 = hir.bitcast v379 : ptr; + v381 = hir.load v380 : i32; + v382 = arith.constant 16 : i32; + v383 = arith.sub v381, v382 : i32 #[overflow = wrapping]; + v384 = 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 + v385 = hir.bitcast v384 : ptr; + hir.store v385, v383; + v395 = hir.bitcast v373 : u32; + v396 = arith.zext v395 : u64; + v397 = hir.bitcast v396 : i64; + v377 = arith.constant 0 : i32; + v390 = arith.sub v377, v375 : i32 #[overflow = wrapping]; + v387 = arith.constant -1 : i32; + v386 = arith.add v375, v376 : i32 #[overflow = wrapping]; + v388 = arith.add v386, v387 : i32 #[overflow = wrapping]; + v391 = arith.band v388, v390 : i32; + v392 = hir.bitcast v391 : u32; + v393 = arith.zext v392 : u64; + v394 = hir.bitcast v393 : i64; + v398 = arith.mul v394, v397 : i64 #[overflow = wrapping]; + v848 = arith.constant 0 : i32; + v399 = arith.constant 32 : i64; + v401 = hir.cast v399 : u32; + v400 = hir.bitcast v398 : u64; + v402 = arith.shr v400, v401 : u64; + v403 = hir.bitcast v402 : i64; + v404 = arith.trunc v403 : i32; + v406 = arith.neq v404, v848 : i1; + v760, v761, v762, v763, v764, v765 = scf.if v406 : i32, i32, i32, i32, i32, u32 { ^block110: - v747 = arith.constant 0 : u32; - v754 = ub.poison i32 : i32; - scf.yield v374, v385, v754, v754, v754, v747; + v745 = arith.constant 0 : u32; + v752 = ub.poison i32 : i32; + scf.yield v372, v383, v752, v752, v752, v745; } else { ^block58: - v409 = arith.trunc v400 : i32; - v849 = arith.constant 0 : i32; - v410 = arith.constant -2147483648 : i32; - v411 = arith.sub v410, v377 : i32 #[overflow = wrapping]; - v413 = hir.bitcast v411 : u32; - v412 = hir.bitcast v409 : u32; - v414 = arith.lte v412, v413 : i1; - v415 = arith.zext v414 : u32; - v416 = hir.bitcast v415 : i32; - v418 = arith.neq v416, v849 : i1; - v810 = scf.if v418 : i32 { + v407 = arith.trunc v398 : i32; + v847 = arith.constant 0 : i32; + v408 = arith.constant -2147483648 : i32; + v409 = arith.sub v408, v375 : i32 #[overflow = wrapping]; + v411 = hir.bitcast v409 : u32; + v410 = hir.bitcast v407 : u32; + v412 = arith.lte v410, v411 : i1; + v413 = arith.zext v412 : u32; + v414 = hir.bitcast v413 : i32; + v416 = arith.neq v414, v847 : i1; + v808 = scf.if v416 : i32 { ^block56: - v848 = arith.constant 0 : i32; - v429 = arith.neq v409, v848 : i1; - v809 = scf.if v429 : i32 { + v846 = arith.constant 0 : i32; + v427 = arith.neq v407, v846 : i1; + v807 = scf.if v427 : i32 { ^block60: - v847 = arith.constant 0 : i32; - v445 = arith.neq v376, v847 : i1; - v808 = scf.if v445 : i32 { + v845 = arith.constant 0 : i32; + v443 = arith.neq v374, v845 : i1; + v806 = scf.if v443 : i32 { ^block63: - v427 = 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::alloc::Global::alloc_impl(v385, v377, v409, v427) - v456 = hir.bitcast v385 : u32; - v501 = arith.constant 4 : u32; - v458 = arith.mod v456, v501 : u32; - hir.assertz v458 #[code = 250]; - v459 = hir.int_to_ptr v456 : ptr; - v460 = hir.load v459 : i32; - scf.yield v460; + v425 = 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::alloc::Global::alloc_impl(v383, v375, v407, v425) + v454 = hir.bitcast v383 : u32; + v499 = arith.constant 4 : u32; + v456 = arith.mod v454, v499 : u32; + hir.assertz v456 #[code = 250]; + v457 = hir.int_to_ptr v454 : ptr; + v458 = hir.load v457 : i32; + scf.yield v458; } else { ^block64: - v446 = arith.constant 8 : i32; - v447 = arith.add v385, v446 : 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(v447, v377, v409) - v431 = arith.constant 8 : u32; - v448 = hir.bitcast v385 : u32; - v450 = arith.add v448, v431 : u32 #[overflow = checked]; - v846 = arith.constant 4 : u32; - v452 = arith.mod v450, v846 : u32; - hir.assertz v452 #[code = 250]; - v453 = hir.int_to_ptr v450 : ptr; - v454 = hir.load v453 : i32; - scf.yield v454; + v444 = arith.constant 8 : i32; + v445 = arith.add v383, v444 : 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(v445, v375, v407) + v429 = arith.constant 8 : u32; + v446 = hir.bitcast v383 : u32; + v448 = arith.add v446, v429 : u32 #[overflow = checked]; + v844 = arith.constant 4 : u32; + v450 = arith.mod v448, v844 : u32; + hir.assertz v450 #[code = 250]; + v451 = hir.int_to_ptr v448 : ptr; + v452 = hir.load v451 : i32; + scf.yield v452; }; - v844 = arith.constant 0 : i32; - v845 = arith.constant 0 : i32; - v463 = arith.eq v808, v845 : i1; - v464 = arith.zext v463 : u32; - v465 = hir.bitcast v464 : i32; - v467 = arith.neq v465, v844 : i1; - scf.if v467{ + v842 = arith.constant 0 : i32; + v843 = arith.constant 0 : i32; + v461 = arith.eq v806, v843 : i1; + v462 = arith.zext v461 : u32; + v463 = hir.bitcast v462 : i32; + v465 = arith.neq v463, v842 : i1; + scf.if v465{ ^block65: - v843 = arith.constant 8 : u32; - v484 = hir.bitcast v374 : u32; - v486 = arith.add v484, v843 : u32 #[overflow = checked]; - v842 = arith.constant 4 : u32; - v488 = arith.mod v486, v842 : u32; - hir.assertz v488 #[code = 250]; - v489 = hir.int_to_ptr v486 : ptr; - hir.store v489, v409; - v841 = arith.constant 4 : u32; - v491 = hir.bitcast v374 : u32; - v493 = arith.add v491, v841 : u32 #[overflow = checked]; + v841 = arith.constant 8 : u32; + v482 = hir.bitcast v372 : u32; + v484 = arith.add v482, v841 : u32 #[overflow = checked]; v840 = arith.constant 4 : u32; - v495 = arith.mod v493, v840 : u32; - hir.assertz v495 #[code = 250]; - v496 = hir.int_to_ptr v493 : ptr; - hir.store v496, v377; + v486 = arith.mod v484, v840 : u32; + hir.assertz v486 #[code = 250]; + v487 = hir.int_to_ptr v484 : ptr; + hir.store v487, v407; + v839 = arith.constant 4 : u32; + v489 = hir.bitcast v372 : u32; + v491 = arith.add v489, v839 : u32 #[overflow = checked]; + v838 = arith.constant 4 : u32; + v493 = arith.mod v491, v838 : u32; + hir.assertz v493 #[code = 250]; + v494 = hir.int_to_ptr v491 : ptr; + hir.store v494, v375; scf.yield ; } else { ^block66: - v839 = arith.constant 8 : u32; - v469 = hir.bitcast v374 : u32; - v471 = arith.add v469, v839 : u32 #[overflow = checked]; - v838 = arith.constant 4 : u32; - v473 = arith.mod v471, v838 : u32; - hir.assertz v473 #[code = 250]; - v474 = hir.int_to_ptr v471 : ptr; - hir.store v474, v808; - v837 = arith.constant 4 : u32; - v476 = hir.bitcast v374 : u32; - v478 = arith.add v476, v837 : u32 #[overflow = checked]; + v837 = arith.constant 8 : u32; + v467 = hir.bitcast v372 : u32; + v469 = arith.add v467, v837 : u32 #[overflow = checked]; v836 = arith.constant 4 : u32; - v480 = arith.mod v478, v836 : u32; - hir.assertz v480 #[code = 250]; - v481 = hir.int_to_ptr v478 : ptr; - hir.store v481, v375; + v471 = arith.mod v469, v836 : u32; + hir.assertz v471 #[code = 250]; + v472 = hir.int_to_ptr v469 : ptr; + hir.store v472, v806; + v835 = arith.constant 4 : u32; + v474 = hir.bitcast v372 : u32; + v476 = arith.add v474, v835 : u32 #[overflow = checked]; + v834 = arith.constant 4 : u32; + v478 = arith.mod v476, v834 : u32; + hir.assertz v478 #[code = 250]; + v479 = hir.int_to_ptr v476 : ptr; + hir.store v479, v373; scf.yield ; }; - v834 = arith.constant 0 : i32; - v835 = arith.constant 1 : i32; - v807 = cf.select v467, v835, v834 : i32; - scf.yield v807; + v832 = arith.constant 0 : i32; + v833 = arith.constant 1 : i32; + v805 = cf.select v465, v833, v832 : i32; + scf.yield v805; } else { ^block61: - v833 = arith.constant 8 : u32; - v430 = hir.bitcast v374 : u32; - v432 = arith.add v430, v833 : u32 #[overflow = checked]; - v832 = arith.constant 4 : u32; - v434 = arith.mod v432, v832 : u32; - hir.assertz v434 #[code = 250]; - v435 = hir.int_to_ptr v432 : ptr; - hir.store v435, v377; - v831 = arith.constant 4 : u32; - v438 = hir.bitcast v374 : u32; - v440 = arith.add v438, v831 : u32 #[overflow = checked]; + v831 = arith.constant 8 : u32; + v428 = hir.bitcast v372 : u32; + v430 = arith.add v428, v831 : u32 #[overflow = checked]; v830 = arith.constant 4 : u32; - v442 = arith.mod v440, v830 : u32; - hir.assertz v442 #[code = 250]; - v829 = arith.constant 0 : i32; - v443 = hir.int_to_ptr v440 : ptr; - hir.store v443, v829; - v828 = arith.constant 0 : i32; - scf.yield v828; + v432 = arith.mod v430, v830 : u32; + hir.assertz v432 #[code = 250]; + v433 = hir.int_to_ptr v430 : ptr; + hir.store v433, v375; + v829 = arith.constant 4 : u32; + v436 = hir.bitcast v372 : u32; + v438 = arith.add v436, v829 : u32 #[overflow = checked]; + v828 = arith.constant 4 : u32; + v440 = arith.mod v438, v828 : u32; + hir.assertz v440 #[code = 250]; + v827 = arith.constant 0 : i32; + v441 = hir.int_to_ptr v438 : ptr; + hir.store v441, v827; + v826 = arith.constant 0 : i32; + scf.yield v826; }; - scf.yield v809; + scf.yield v807; } else { ^block59: - v827 = ub.poison i32 : i32; - scf.yield v827; + v825 = ub.poison i32 : i32; + scf.yield v825; }; - v822 = arith.constant 0 : u32; - v755 = arith.constant 1 : u32; - v815 = cf.select v418, v755, v822 : u32; + v820 = arith.constant 0 : u32; + v753 = arith.constant 1 : u32; + v813 = cf.select v416, v753, v820 : u32; + v821 = ub.poison i32 : i32; + v812 = cf.select v416, v383, v821 : i32; + v822 = ub.poison i32 : i32; + v811 = cf.select v416, v372, v822 : i32; v823 = ub.poison i32 : i32; - v814 = cf.select v418, v385, v823 : i32; + v810 = cf.select v416, v823, v383 : i32; v824 = ub.poison i32 : i32; - v813 = cf.select v418, v374, v824 : i32; - v825 = ub.poison i32 : i32; - v812 = cf.select v418, v825, v385 : i32; - v826 = ub.poison i32 : i32; - v811 = cf.select v418, v826, v374 : i32; - scf.yield v811, v812, v813, v810, v814, v815; + v809 = cf.select v416, v824, v372 : i32; + scf.yield v809, v810, v811, v808, v812, v813; }; - v768, v769, v770 = scf.index_switch v767 : i32, i32, i32 + v766, v767, v768 = scf.index_switch v765 : i32, i32, i32 case 0 { ^block57: - v821 = arith.constant 4 : u32; - v421 = hir.bitcast v762 : u32; - v423 = arith.add v421, v821 : u32 #[overflow = checked]; - v820 = arith.constant 4 : u32; - v425 = arith.mod v423, v820 : u32; - hir.assertz v425 #[code = 250]; - v819 = arith.constant 0 : i32; - v426 = hir.int_to_ptr v423 : ptr; - hir.store v426, v819; - v818 = arith.constant 1 : i32; - scf.yield v762, v818, v763; + v819 = arith.constant 4 : u32; + v419 = hir.bitcast v760 : u32; + v421 = arith.add v419, v819 : u32 #[overflow = checked]; + v818 = arith.constant 4 : u32; + v423 = arith.mod v421, v818 : u32; + hir.assertz v423 #[code = 250]; + v817 = arith.constant 0 : i32; + v424 = hir.int_to_ptr v421 : ptr; + hir.store v424, v817; + v816 = arith.constant 1 : i32; + scf.yield v760, v816, v761; } default { ^block114: - scf.yield v764, v765, v766; + scf.yield v762, v763, v764; }; - v500 = hir.bitcast v768 : u32; - v817 = arith.constant 4 : u32; - v502 = arith.mod v500, v817 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - hir.store v503, v769; - v816 = arith.constant 16 : i32; - v508 = arith.add v770, v816 : i32 #[overflow = wrapping]; - v509 = 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 - v510 = hir.bitcast v509 : ptr; - hir.store v510, v508; + v498 = hir.bitcast v766 : u32; + v815 = arith.constant 4 : u32; + v500 = arith.mod v498, v815 : u32; + hir.assertz v500 #[code = 250]; + v501 = hir.int_to_ptr v498 : ptr; + hir.store v501, v767; + v814 = arith.constant 16 : i32; + v506 = arith.add v768, v814 : i32 #[overflow = wrapping]; + v507 = 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 + v508 = hir.bitcast v507 : ptr; + hir.store v508, v506; builtin.ret ; }; - private builtin.function @::allocate(v511: i32, v512: i32, v513: i32) { - ^block67(v511: i32, v512: i32, v513: i32): - v515 = 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 - v516 = hir.bitcast v515 : ptr; - v517 = hir.load v516 : i32; - v518 = arith.constant 16 : i32; - v519 = arith.sub v517, v518 : i32 #[overflow = wrapping]; - v520 = 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 - v521 = hir.bitcast v520 : ptr; - hir.store v521, v519; - v514 = arith.constant 0 : i32; - v522 = arith.constant 8 : i32; - v523 = arith.add v519, v522 : 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::alloc::Global::alloc_impl(v523, v512, v513, v514) - v526 = arith.constant 12 : u32; - v525 = hir.bitcast v519 : u32; - v527 = arith.add v525, v526 : u32 #[overflow = checked]; - v528 = arith.constant 4 : u32; - v529 = arith.mod v527, v528 : u32; - hir.assertz v529 #[code = 250]; - v530 = hir.int_to_ptr v527 : ptr; - v531 = hir.load v530 : i32; - v533 = arith.constant 8 : u32; - v532 = hir.bitcast v519 : u32; - v534 = arith.add v532, v533 : u32 #[overflow = checked]; - v855 = arith.constant 4 : u32; - v536 = arith.mod v534, v855 : u32; - hir.assertz v536 #[code = 250]; - v537 = hir.int_to_ptr v534 : ptr; - v538 = hir.load v537 : i32; - v539 = hir.bitcast v511 : u32; - v854 = arith.constant 4 : u32; - v541 = arith.mod v539, v854 : u32; - hir.assertz v541 #[code = 250]; - v542 = hir.int_to_ptr v539 : ptr; - hir.store v542, v538; + private builtin.function @::allocate(v509: i32, v510: i32, v511: i32) { + ^block67(v509: i32, v510: i32, v511: i32): + v513 = 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 + v514 = hir.bitcast v513 : ptr; + v515 = hir.load v514 : i32; + v516 = arith.constant 16 : i32; + v517 = arith.sub v515, v516 : i32 #[overflow = wrapping]; + v518 = 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 + v519 = hir.bitcast v518 : ptr; + hir.store v519, v517; + v512 = arith.constant 0 : i32; + v520 = arith.constant 8 : i32; + v521 = arith.add v517, v520 : 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::alloc::Global::alloc_impl(v521, v510, v511, v512) + v524 = arith.constant 12 : u32; + v523 = hir.bitcast v517 : 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 : i32; + v531 = arith.constant 8 : u32; + v530 = hir.bitcast v517 : u32; + v532 = arith.add v530, v531 : u32 #[overflow = checked]; v853 = arith.constant 4 : u32; - v543 = hir.bitcast v511 : u32; - v545 = arith.add v543, v853 : u32 #[overflow = checked]; + v534 = arith.mod v532, v853 : u32; + hir.assertz v534 #[code = 250]; + v535 = hir.int_to_ptr v532 : ptr; + v536 = hir.load v535 : i32; + v537 = hir.bitcast v509 : u32; v852 = arith.constant 4 : u32; - v547 = arith.mod v545, v852 : u32; - hir.assertz v547 #[code = 250]; - v548 = hir.int_to_ptr v545 : ptr; - hir.store v548, v531; - v851 = arith.constant 16 : i32; - v550 = arith.add v519, v851 : i32 #[overflow = wrapping]; - v551 = 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 - v552 = hir.bitcast v551 : ptr; - hir.store v552, v550; + v539 = arith.mod v537, v852 : u32; + hir.assertz v539 #[code = 250]; + v540 = hir.int_to_ptr v537 : ptr; + hir.store v540, v536; + v851 = arith.constant 4 : u32; + v541 = hir.bitcast v509 : u32; + v543 = arith.add v541, v851 : u32 #[overflow = checked]; + v850 = arith.constant 4 : u32; + v545 = arith.mod v543, v850 : u32; + hir.assertz v545 #[code = 250]; + v546 = hir.int_to_ptr v543 : ptr; + hir.store v546, v529; + v849 = arith.constant 16 : i32; + v548 = arith.add v517, v849 : i32 #[overflow = wrapping]; + v549 = 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 + v550 = hir.bitcast v549 : ptr; + hir.store v550, v548; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v553: i32, v554: i32, v555: i32, v556: i32) { - ^block69(v553: i32, v554: i32, v555: i32, v556: i32): - v871 = arith.constant 0 : i32; - v557 = arith.constant 0 : i32; - v558 = arith.eq v555, v557 : i1; - v559 = arith.zext v558 : u32; - v560 = hir.bitcast v559 : i32; - v562 = arith.neq v560, v871 : i1; - v867 = scf.if v562 : i32 { + private builtin.function @alloc::alloc::Global::alloc_impl(v551: i32, v552: i32, v553: i32, v554: i32) { + ^block69(v551: i32, v552: i32, v553: i32, v554: i32): + v869 = arith.constant 0 : i32; + v555 = arith.constant 0 : i32; + v556 = arith.eq v553, v555 : i1; + v557 = arith.zext v556 : u32; + v558 = hir.bitcast v557 : i32; + v560 = arith.neq v558, v869 : i1; + v865 = scf.if v560 : i32 { ^block117: - scf.yield v554; + scf.yield v552; } else { ^block72: 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() - v870 = arith.constant 0 : i32; - v564 = arith.neq v556, v870 : i1; - v866 = scf.if v564 : i32 { + v868 = arith.constant 0 : i32; + v562 = arith.neq v554, v868 : i1; + v864 = scf.if v562 : i32 { ^block73: - v566 = 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(v555, v554) : i32 - scf.yield v566; + v564 = 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(v553, v552) : i32 + scf.yield v564; } else { ^block74: - v565 = 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(v555, v554) : i32 - scf.yield v565; + v563 = 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(v553, v552) : i32 + scf.yield v563; }; - scf.yield v866; + scf.yield v864; }; - v570 = arith.constant 4 : u32; - v569 = hir.bitcast v553 : u32; - v571 = arith.add v569, v570 : u32 #[overflow = checked]; - v869 = arith.constant 4 : u32; - v573 = arith.mod v571, v869 : u32; - hir.assertz v573 #[code = 250]; - v574 = hir.int_to_ptr v571 : ptr; - hir.store v574, v555; - v576 = hir.bitcast v553 : u32; - v868 = arith.constant 4 : u32; - v578 = arith.mod v576, v868 : u32; - hir.assertz v578 #[code = 250]; - v579 = hir.int_to_ptr v576 : ptr; - hir.store v579, v867; + v568 = arith.constant 4 : u32; + v567 = hir.bitcast v551 : u32; + v569 = arith.add v567, v568 : u32 #[overflow = checked]; + v867 = arith.constant 4 : u32; + v571 = arith.mod v569, v867 : u32; + hir.assertz v571 #[code = 250]; + v572 = hir.int_to_ptr v569 : ptr; + hir.store v572, v553; + v574 = hir.bitcast v551 : u32; + v866 = arith.constant 4 : u32; + v576 = arith.mod v574, v866 : u32; + hir.assertz v576 #[code = 250]; + v577 = hir.int_to_ptr v574 : ptr; + hir.store v577, v865; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v580: i32, v581: i32, v582: i32, v583: i32) { - ^block75(v580: i32, v581: i32, v582: i32, v583: i32): - v897 = arith.constant 0 : i32; - v584 = arith.constant 0 : i32; - v588 = arith.eq v583, v584 : i1; - v589 = arith.zext v588 : u32; - v590 = hir.bitcast v589 : i32; - v592 = arith.neq v590, v897 : i1; - v884, v885 = scf.if v592 : i32, i32 { + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v578: i32, v579: i32, v580: i32, v581: i32) { + ^block75(v578: i32, v579: i32, v580: i32, v581: i32): + v895 = arith.constant 0 : i32; + v582 = arith.constant 0 : i32; + v586 = arith.eq v581, v582 : i1; + v587 = arith.zext v586 : u32; + v588 = hir.bitcast v587 : i32; + v590 = arith.neq v588, v895 : i1; + v882, v883 = scf.if v590 : i32, i32 { ^block121: - v896 = arith.constant 0 : i32; - v586 = arith.constant 4 : i32; - scf.yield v586, v896; + v894 = arith.constant 0 : i32; + v584 = arith.constant 4 : i32; + scf.yield v584, v894; } else { ^block78: - v593 = hir.bitcast v581 : u32; - v628 = arith.constant 4 : u32; - v595 = arith.mod v593, v628 : u32; - hir.assertz v595 #[code = 250]; - v596 = hir.int_to_ptr v593 : ptr; - v597 = hir.load v596 : i32; - v894 = arith.constant 0 : i32; - v895 = arith.constant 0 : i32; - v599 = arith.eq v597, v895 : i1; - v600 = arith.zext v599 : u32; - v601 = hir.bitcast v600 : i32; - v603 = arith.neq v601, v894 : i1; - v882 = scf.if v603 : i32 { + v591 = hir.bitcast v579 : u32; + v626 = arith.constant 4 : u32; + v593 = arith.mod v591, v626 : u32; + hir.assertz v593 #[code = 250]; + v594 = hir.int_to_ptr v591 : ptr; + v595 = hir.load v594 : i32; + v892 = arith.constant 0 : i32; + v893 = arith.constant 0 : i32; + v597 = arith.eq v595, v893 : i1; + v598 = arith.zext v597 : u32; + v599 = hir.bitcast v598 : i32; + v601 = arith.neq v599, v892 : i1; + v880 = scf.if v601 : i32 { ^block120: - v893 = arith.constant 0 : i32; - scf.yield v893; + v891 = arith.constant 0 : i32; + scf.yield v891; } else { ^block79: - v892 = arith.constant 4 : u32; - v604 = hir.bitcast v580 : u32; - v606 = arith.add v604, v892 : u32 #[overflow = checked]; - v891 = arith.constant 4 : u32; - v608 = arith.mod v606, v891 : u32; - hir.assertz v608 #[code = 250]; - v609 = hir.int_to_ptr v606 : ptr; - hir.store v609, v582; v890 = arith.constant 4 : u32; - v610 = hir.bitcast v581 : u32; - v612 = arith.add v610, v890 : u32 #[overflow = checked]; + v602 = hir.bitcast v578 : u32; + v604 = arith.add v602, v890 : u32 #[overflow = checked]; v889 = arith.constant 4 : u32; - v614 = arith.mod v612, v889 : u32; - hir.assertz v614 #[code = 250]; - v615 = hir.int_to_ptr v612 : ptr; - v616 = hir.load v615 : i32; - v617 = hir.bitcast v580 : u32; + v606 = arith.mod v604, v889 : u32; + hir.assertz v606 #[code = 250]; + v607 = hir.int_to_ptr v604 : ptr; + hir.store v607, v580; v888 = arith.constant 4 : u32; - v619 = arith.mod v617, v888 : u32; - hir.assertz v619 #[code = 250]; - v620 = hir.int_to_ptr v617 : ptr; - hir.store v620, v616; - v621 = arith.mul v597, v583 : i32 #[overflow = wrapping]; - scf.yield v621; + v608 = hir.bitcast v579 : u32; + v610 = arith.add v608, v888 : u32 #[overflow = checked]; + v887 = arith.constant 4 : u32; + v612 = arith.mod v610, v887 : u32; + hir.assertz v612 #[code = 250]; + v613 = hir.int_to_ptr v610 : ptr; + v614 = hir.load v613 : i32; + v615 = hir.bitcast v578 : u32; + v886 = arith.constant 4 : u32; + v617 = arith.mod v615, v886 : u32; + hir.assertz v617 #[code = 250]; + v618 = hir.int_to_ptr v615 : ptr; + hir.store v618, v614; + v619 = arith.mul v595, v581 : i32 #[overflow = wrapping]; + scf.yield v619; }; - v622 = arith.constant 8 : i32; - v887 = arith.constant 4 : i32; - v883 = cf.select v603, v887, v622 : i32; - scf.yield v883, v882; + v620 = arith.constant 8 : i32; + v885 = arith.constant 4 : i32; + v881 = cf.select v601, v885, v620 : i32; + scf.yield v881, v880; }; - v625 = arith.add v580, v884 : i32 #[overflow = wrapping]; - v627 = hir.bitcast v625 : u32; - v886 = arith.constant 4 : u32; - v629 = arith.mod v627, v886 : u32; - hir.assertz v629 #[code = 250]; - v630 = hir.int_to_ptr v627 : ptr; - hir.store v630, v885; + v623 = arith.add v578, v882 : i32 #[overflow = wrapping]; + v625 = hir.bitcast v623 : u32; + v884 = arith.constant 4 : u32; + v627 = arith.mod v625, v884 : u32; + hir.assertz v627 #[code = 250]; + v628 = hir.int_to_ptr v625 : ptr; + hir.store v628, v883; builtin.ret ; }; - private builtin.function @::deallocate(v631: i32, v632: i32, v633: i32) { - ^block80(v631: i32, v632: i32, v633: i32): - v899 = arith.constant 0 : i32; - v634 = arith.constant 0 : i32; - v635 = arith.eq v633, v634 : i1; - v636 = arith.zext v635 : u32; - v637 = hir.bitcast v636 : i32; - v639 = arith.neq v637, v899 : i1; - scf.if v639{ + private builtin.function @::deallocate(v629: i32, v630: i32, v631: i32) { + ^block80(v629: i32, v630: i32, v631: i32): + v897 = arith.constant 0 : i32; + v632 = arith.constant 0 : i32; + v633 = arith.eq v631, v632 : i1; + v634 = arith.zext v633 : u32; + v635 = hir.bitcast v634 : i32; + v637 = arith.neq v635, v897 : i1; + scf.if v637{ ^block82: scf.yield ; } else { ^block83: - 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(v631, v633, v632) + 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(v629, v631, v630) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v640: i32, v641: i32, v642: i32) { - ^block84(v640: i32, v641: i32, v642: i32): + private builtin.function @alloc::raw_vec::handle_error(v638: i32, v639: i32, v640: i32) { + ^block84(v638: i32, v639: i32, v640: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v643: i32, v644: i32) -> i32 { - ^block86(v643: i32, v644: i32): - v651 = arith.constant 0 : i32; - v647 = hir.bitcast v644 : u32; - v646 = hir.bitcast v643 : u32; - v648 = arith.gt v646, v647 : i1; - v649 = arith.zext v648 : u32; - v650 = hir.bitcast v649 : i32; - v652 = arith.neq v650, v651 : i1; - v653 = cf.select v652, v643, v644 : i32; - builtin.ret v653; + private builtin.function @core::ptr::alignment::Alignment::max(v641: i32, v642: i32) -> i32 { + ^block86(v641: i32, v642: i32): + v649 = arith.constant 0 : i32; + v645 = hir.bitcast v642 : u32; + v644 = hir.bitcast v641 : u32; + v646 = arith.gt v644, v645 : i1; + v647 = arith.zext v646 : u32; + v648 = hir.bitcast v647 : i32; + v650 = arith.neq v648, v649 : i1; + v651 = cf.select v650, v641, v642 : i32; + builtin.ret v651; }; - private builtin.function @miden::output_note::get_assets(v654: i32, v655: felt) -> i32 { - ^block88(v654: i32, v655: felt): - v656, v657 = hir.exec @miden/output_note/get_assets(v654, v655) : i32, i32 - builtin.ret v656; + private builtin.function @miden::output_note::get_assets(v652: i32, v653: felt) -> i32 { + ^block88(v652: i32, v653: felt): + v654, v655 = hir.exec @miden/output_note/get_assets(v652, v653) : i32, i32 + builtin.ret v654; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -945,14 +945,14 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f74757074756f2f73676e69646e69622f6372732f302e382e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; - builtin.segment @1048628 = 0x000000220000006500000030001000000000000100000001; + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { ^block92: - v659 = 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 v659; + v657 = 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 v657; }; }; \ 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 6ef08bce4..580c99e36 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 @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[1299769949614318155,17537286569450742772,6595043140619191035,14014199975760862929] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.5 + push.3 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278552 + mem_store.278544 push.0 u32assert - mem_store.278553 + mem_store.278545 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 @@ -45,7 +45,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -53,7 +53,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048652 + push.1048612 u32wrapping_add movup.2 swap.1 @@ -73,7 +73,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -81,7 +81,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048652 + push.1048612 u32wrapping_add dup.1 swap.2 @@ -167,7 +167,7 @@ end proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding( ) -> felt - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -177,7 +177,7 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -243,7 +243,7 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse push.16 movup.2 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -264,7 +264,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -272,7 +272,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048656 + push.1048616 u32wrapping_add u32divmod.4 swap.1 @@ -293,7 +293,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114212 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -307,7 +307,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048656 + push.1048616 movup.2 u32wrapping_add u32divmod.4 @@ -526,8 +526,8 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc alloc::vec::Vec::with_capacity(i32, i32) - push.1114208 +proc alloc::vec::Vec::with_capacity(i32) + push.1114176 u32divmod.4 swap.1 trace.240 @@ -537,7 +537,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -552,9 +552,6 @@ proc alloc::vec::Vec::with_capacity(i32, i32) dup.2 u32wrapping_add dup.1 - movup.3 - swap.5 - movdn.3 swap.2 swap.1 trace.240 @@ -563,7 +560,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) trace.252 nop push.8 - dup.2 + dup.1 add u32assert push.8 @@ -580,7 +577,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) trace.252 nop push.8 - dup.3 + dup.4 add u32assert push.4 @@ -598,7 +595,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + movup.3 push.4 dup.1 swap.1 @@ -614,7 +611,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -626,12 +623,11 @@ end @callconv("C") proc alloc::raw_vec::RawVecInner::with_capacity_in( - i32, i32, i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -641,7 +637,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -707,8 +703,6 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( neq neq if.true - movup.3 - drop push.12 dup.2 add @@ -759,7 +753,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -770,8 +764,16 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( else movup.2 drop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + movup.3 add u32assert push.4 @@ -787,7 +789,10 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 + push.1048596 + movup.2 + u32wrapping_add + 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::raw_vec::handle_error @@ -803,7 +808,7 @@ proc miden_base_sys::bindings::output_note::get_assets( i32, felt ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -813,7 +818,7 @@ proc miden_base_sys::bindings::output_note::get_assets( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -823,18 +828,8 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop - push.1114212 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048636 - u32wrapping_add push.4 - dup.2 + dup.1 u32wrapping_add trace.240 nop @@ -918,7 +913,7 @@ proc miden_base_sys::bindings::output_note::get_assets( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -939,7 +934,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -949,7 +944,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1040,7 +1035,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1058,7 +1053,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1068,7 +1063,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1453,7 +1448,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1469,7 +1464,7 @@ proc ::allocate( i32, i32 ) - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1479,7 +1474,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114208 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1572,7 +1567,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114208 + push.1114176 u32divmod.4 swap.1 trace.240 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 c12fc3177..e6cbffb40 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 @@ -13,11 +13,11 @@ (type (;3;) (func (result f32))) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) - (type (;6;) (func (param 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 (;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 i32))) + (type (;10;) (func (param i32 i32 i32 i32))) (type (;11;) (func (param i32 f32) (result i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -29,7 +29,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048652 + i32.const 1048612 i32.add local.get 1 local.get 0 @@ -39,7 +39,7 @@ (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 1048652 + i32.const 1048612 i32.add local.get 1 local.get 0 @@ -95,7 +95,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048656 + i32.const 1048616 i32.add i32.load8_u br_if 0 (;@1;) @@ -103,7 +103,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048656 + i32.const 1048616 i32.add i32.const 1 i32.store8 @@ -184,42 +184,41 @@ (func $intrinsics::mem::heap_base (;9;) (type 5) (result i32) unreachable ) - (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32 i32) + (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32) (local i32 i64) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 2 + local.tee 1 global.set $__stack_pointer - local.get 2 + local.get 1 i32.const 8 i32.add i32.const 16 i32.const 16 - local.get 1 call $alloc::raw_vec::RawVecInner::with_capacity_in - local.get 2 + local.get 1 i64.load offset=8 - local.set 3 + local.set 2 local.get 0 i32.const 0 i32.store offset=8 local.get 0 - local.get 3 - i64.store align=4 local.get 2 + i64.store align=4 + local.get 1 i32.const 16 i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 7) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 4 + local.tee 3 global.set $__stack_pointer - local.get 4 + local.get 3 i32.const 4 i32.add i32.const 256 @@ -227,35 +226,39 @@ local.get 1 local.get 2 call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 4 + local.get 3 i32.load offset=8 local.set 2 block ;; label = @1 - local.get 4 + local.get 3 i32.load offset=4 i32.const 1 i32.ne br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 local.get 2 - local.get 4 - i32.load offset=12 local.get 3 + i32.load offset=12 + local.get 0 + i32.const 1048596 + i32.add call $alloc::raw_vec::handle_error unreachable end local.get 0 - local.get 4 + local.get 3 i32.load offset=12 i32.store offset=4 local.get 0 local.get 2 i32.store - local.get 4 + local.get 3 i32.const 16 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::output_note::get_assets (;12;) (type 8) (param i32 f32) + (func $miden_base_sys::bindings::output_note::get_assets (;12;) (type 7) (param i32 f32) (local i32) global.get $__stack_pointer i32.const 16 @@ -265,9 +268,6 @@ local.get 2 i32.const 4 i32.add - global.get $GOT.data.internal.__memory_base - i32.const 1048636 - i32.add call $alloc::vec::Vec::with_capacity local.get 0 i32.const 8 @@ -288,7 +288,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;13;) (type 9) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;13;) (type 8) (param i32) (result f32) unreachable ) (func $alloc::raw_vec::RawVecInner::deallocate (;14;) (type 2) (param i32 i32 i32) @@ -323,7 +323,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 10) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -464,7 +464,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;17;) (type 7) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;17;) (type 10) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -491,7 +491,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 7) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 10) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -551,8 +551,8 @@ (func $miden::output_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.8.0/src/bindings/output_note.rs\00") - (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00e\00\00\00\22\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\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\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "felt" (type (;1;))) diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index 89fac3d8e..d580469ad 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -87,9 +87,13 @@ impl BuildCommand { spawn_args.push(format!("{key}={value}")); } - let extra_rust_flags = String::from( - "-C target-feature=+bulk-memory,+wide-arithmetic -C link-args=--fatal-warnings", - ); + // Enable memcopy and 128-bit arithmetic ops + let mut extra_rust_flags = String::from("-C target-feature=+bulk-memory,+wide-arithmetic"); + // 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 + // https://doc.rust-lang.org/beta/unstable-book/compiler-flags/location-detail.html + extra_rust_flags.push_str(" -Zlocation-detail=none"); let maybe_old_rustflags = match std::env::var("RUSTFLAGS") { Ok(current) if !current.is_empty() => { std::env::set_var("RUSTFLAGS", format!("{current} {extra_rust_flags}")); From 563d36e0c9ae5603d72116cd8dff0ecc4a14374c Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Sun, 23 Nov 2025 08:25:35 +0100 Subject: [PATCH 12/70] chore: fix release artifact build --- Makefile.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index 5eaed34ca..ca9ec38ca 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -182,7 +182,7 @@ args = [ "midenc", "--artifact-dir", "${MIDENC_BIN_DIR}", - "@@split(CARGO_MAKE_TASK_ARGS, )", + "@@split(CARGO_MAKE_TASK_ARGS, ;)", ] [tasks.cargo-miden] @@ -197,7 +197,7 @@ args = [ "cargo-miden", "--artifact-dir", "${MIDENC_BIN_DIR}", - "@@split(CARGO_MAKE_TASK_ARGS, )", + "@@split(CARGO_MAKE_TASK_ARGS, ;)", ] [tasks.build] From e184bead36aa4653921b1613d18134f92087c153 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Sun, 23 Nov 2025 09:50:02 +0100 Subject: [PATCH 13/70] chore: keep changes to all packages in one `CHANGELOG.md` and use it in a github release --- CHANGELOG.md | 0 release-plz.toml | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..e69de29bb diff --git a/release-plz.toml b/release-plz.toml index dadb82f9c..98d066ed9 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -7,6 +7,8 @@ release_always = false # We don't want release-plz creating tags for every published crate. git_release_enable = false git_tag_enable = false +# set the path of all the crates to the changelog to the root of the repository +changelog_path = "./CHANGELOG.md" [[package]] # The version bumps from any compiler crate should bubble up and bump the @@ -18,3 +20,21 @@ git_tag_enable = true git_tag_name = "{{ version }}" git_release_name = "{{ version }}" + +[changelog] +# group all the changes from all the packages in a single changelog +# via https://release-plz.dev/docs/extra/single-changelog +body = """ + +## `{{ package }}` - [{{ version }}]{%- if release_link -%}({{ release_link }}){% endif %} - {{ timestamp | date(format="%Y-%m-%d") }} +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | upper_first }} +{% for commit in commits %} +{%- if commit.scope -%} +- *({{commit.scope}})* {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{%- if commit.links %} ({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor -%}){% endif %} +{% else -%} +- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} +{% endif -%} +{% endfor -%} +{% endfor -%} +""" From c6c6f33118c075073e84121d149cd9bfbb9b695a Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 20 Nov 2025 18:42:17 -0300 Subject: [PATCH 14/70] refactor: migrate to WIT generation macro in counter-contract example, run `cargo update`, update miden-node to v0.12.2 in the local network tests. --- Cargo.lock | 352 +++++++++++++----- examples/counter-contract/Cargo.toml | 4 +- examples/counter-contract/src/lib.rs | 28 +- examples/counter-contract/wit/counter.wit | 17 - examples/counter-note/Cargo.toml | 3 +- examples/counter-note/src/lib.rs | 8 +- .../integration-node/src/local_node/setup.rs | 2 +- .../src/node_tests/counter_contract.rs | 43 +-- .../integration/expected/examples/counter.hir | 86 ++--- .../expected/examples/counter.masm | 68 ++-- .../integration/expected/examples/counter.wat | 14 +- .../expected/examples/counter_note.hir | 14 +- .../expected/examples/counter_note.masm | 14 +- .../expected/examples/counter_note.wat | 14 +- 14 files changed, 391 insertions(+), 276 deletions(-) delete mode 100644 examples/counter-contract/wit/counter.wit diff --git a/Cargo.lock b/Cargo.lock index a7d9161b4..62fa3da20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,22 +127,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -328,6 +328,15 @@ 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 +361,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] name = "camino" @@ -457,9 +466,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.45" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ "find-msvc-tools", "jobserver", @@ -473,6 +482,12 @@ 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" @@ -550,9 +565,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.51" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" dependencies = [ "clap_builder", "clap_derive", @@ -560,9 +575,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.51" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" dependencies = [ "anstream", "anstyle", @@ -809,9 +824,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", @@ -967,6 +982,16 @@ 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" @@ -1145,9 +1170,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "fixedbitset" @@ -1197,9 +1222,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "fs-err" -version = "3.1.3" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ad492b2cf1d89d568a43508ab24f98501fe03f2f31c01e1d0fe7366a71745d2" +checksum = "62d91fd049c123429b018c47887d3f75a265540dd3c30ba9cb7bae9197edb03a" dependencies = [ "autocfg", ] @@ -1325,9 +1350,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.9" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -1460,15 +1485,16 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ "allocator-api2", "equivalent", "foldhash 0.2.0", "rayon", "serde", + "serde_core", ] [[package]] @@ -1580,9 +1606,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1744436df46f0bde35af3eda22aeaba453aada65d8f1c171cd8a5f59030bd69f" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" dependencies = [ "atomic-waker", "bytes", @@ -1616,9 +1642,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" +checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" dependencies = [ "bytes", "futures-channel", @@ -1695,12 +1721,12 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", - "hashbrown 0.16.0", + "hashbrown 0.16.1", "serde", "serde_core", ] @@ -2263,9 +2289,9 @@ dependencies = [ [[package]] name = "miden-client" -version = "0.12.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3170c04004fefbb579facfdbc94889202e862998bb0ec49af687353b1982b1" +checksum = "20c061c44b345267a9d144fb1cb2d2f7b47a9257f52d7907004297df8a3de1d7" dependencies = [ "anyhow", "async-trait", @@ -2298,9 +2324,9 @@ dependencies = [ [[package]] name = "miden-client-sqlite-store" -version = "0.12.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f74888dbb2269093a1fc38cd14e0ec71413f41a2eb24ebb5a9bb138f661311" +checksum = "57f806b34687798a0545177619196017362cb3b67bd0c7003081d1fd5d179c70" dependencies = [ "anyhow", "async-trait", @@ -2345,7 +2371,7 @@ dependencies = [ "ed25519-dalek", "flume", "glob", - "hashbrown 0.16.0", + "hashbrown 0.16.1", "hkdf", "k256", "miden-crypto-derive", @@ -2490,9 +2516,9 @@ dependencies = [ [[package]] name = "miden-lib" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44abeb7f67252547fa54605e61e89256fa546e2f25de382ccac78a1ced07ff88" +checksum = "015992e9a31a4a2667adf2ee795d5f02927a6e9f4e21490ce02fb6395eb6bd41" dependencies = [ "Inflector", "fs-err", @@ -2562,9 +2588,9 @@ dependencies = [ [[package]] name = "miden-node-proto-build" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c26ad2f622716259baf57990226a7285290f6ef5e98bc69028a6727a19a2d7ad" +checksum = "f083bf3a275076f207fa36d4e247c1554e7310c9b85c245b2fc5fbb69934f437" dependencies = [ "fs-err", "miette", @@ -2586,9 +2612,9 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "57ea15ca33d7735e08e81afd9c9f4f02fc0259ec019fcb4ec44192c205743553" dependencies = [ "bech32", "getrandom 0.3.4", @@ -2598,6 +2624,7 @@ dependencies = [ "miden-crypto", "miden-mast-package", "miden-processor", + "miden-stdlib", "miden-utils-sync", "miden-verifier", "rand", @@ -2643,9 +2670,9 @@ dependencies = [ [[package]] name = "miden-remote-prover-client" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045f5ef567fe03b0c515a73c62b33ea9a69b4e54d6b538e23fa3837f25ea09fc" +checksum = "23a02c8c0a548982dc7871df53df6c703119d47c6a3c746604de2979bcff4b42" dependencies = [ "getrandom 0.3.4", "miden-node-proto-build", @@ -2707,9 +2734,9 @@ dependencies = [ [[package]] name = "miden-tx" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d0ddcbaaa1002b954525212ebfa7ee097e6af9d26847b3d977b3ffa9f3edeb" +checksum = "94f5295f8646bc84829ebda923448aebffa2a36f88ef2112b7b4538901e1b34b" dependencies = [ "miden-lib", "miden-objects", @@ -3144,6 +3171,18 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nu-ansi-term" version = "0.50.3" @@ -3254,6 +3293,165 @@ dependencies = [ "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", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +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" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" +dependencies = [ + "objc2", + "objc2-foundation", +] + [[package]] name = "object" version = "0.36.7" @@ -3328,14 +3526,18 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "os_info" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0e1ac5fde8d43c34139135df8ea9ee9465394b2d8d20f032d38998f64afffc3" +checksum = "7c39b5918402d564846d5aba164c09a66cc88d232179dfd3e3c619a25a268392" dependencies = [ + "android_system_properties", "log", - "plist", + "nix", + "objc2", + "objc2-foundation", + "objc2-ui-kit", "serde", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3533,19 +3735,6 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" -[[package]] -name = "plist" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" -dependencies = [ - "base64", - "indexmap", - "quick-xml", - "serde", - "time", -] - [[package]] name = "plotters" version = "0.3.7" @@ -3860,15 +4049,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-xml" -version = "0.38.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89" -dependencies = [ - "memchr", -] - [[package]] name = "quote" version = "1.0.42" @@ -5465,12 +5645,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.240.0" +version = "0.241.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d642d8c5ecc083aafe9ceb32809276a304547a3a6eeecceb5d8152598bc71f" +checksum = "e01164c9dda68301e34fdae536c23ed6fe90ce6d97213ccc171eebbd3d02d6b8" dependencies = [ "leb128fmt", - "wasmparser 0.240.0", + "wasmparser 0.241.2", ] [[package]] @@ -5523,9 +5703,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.240.0" +version = "0.241.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b722dcf61e0ea47440b53ff83ccb5df8efec57a69d150e4f24882e4eba7e24a4" +checksum = "46d90019b1afd4b808c263e428de644f3003691f243387d30d673211ee0cb8e8" dependencies = [ "bitflags", "indexmap", @@ -5545,22 +5725,22 @@ dependencies = [ [[package]] name = "wast" -version = "240.0.0" +version = "241.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0efe1c93db4ac562b9733e3dca19ed7fc878dba29aef22245acf84f13da4a19" +checksum = "63f66e07e2ddf531fef6344dbf94d112df7c2f23ed6ffb10962e711500b8d816" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.0", - "wasm-encoder 0.240.0", + "wasm-encoder 0.241.2", ] [[package]] name = "wat" -version = "1.240.0" +version = "1.241.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec9b6eab7ecd4d639d78515e9ea491c9bacf494aa5eda10823bd35992cf8c1e" +checksum = "45f923705c40830af909c5dec2352ec2821202e4a66008194585e1917458a26d" dependencies = [ "wast", ] @@ -6210,18 +6390,18 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" -version = "0.8.27" +version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.27" +version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26" dependencies = [ "proc-macro2", "quote", diff --git a/examples/counter-contract/Cargo.toml b/examples/counter-contract/Cargo.toml index cc30f4df6..b0fab6cd0 100644 --- a/examples/counter-contract/Cargo.toml +++ b/examples/counter-contract/Cargo.toml @@ -12,8 +12,8 @@ crate-type = ["cdylib"] [dependencies] miden = { path = "../../sdk/sdk" } -# [package.metadata.component] -# package = "miden:counter-contract" +[package.metadata.component] +package = "miden:counter-contract" [package.metadata.miden] project-kind = "account" diff --git a/examples/counter-contract/src/lib.rs b/examples/counter-contract/src/lib.rs index 0e2c188ce..2b7352478 100644 --- a/examples/counter-contract/src/lib.rs +++ b/examples/counter-contract/src/lib.rs @@ -8,11 +8,6 @@ use miden::{component, felt, Felt, StorageMap, StorageMapAccess, Word}; -use crate::bindings::exports::miden::counter_contract::counter::Guest; - -miden::generate!(); -bindings::export!(CounterContract); - /// Main contract structure for the counter example. #[component] struct CounterContract { @@ -21,29 +16,20 @@ struct CounterContract { count_map: StorageMap, } -impl Guest for CounterContract { +#[component] +impl CounterContract { /// Returns the current counter value stored in the contract's storage map. - fn get_count() -> Felt { - // Get the instance of the contract - let contract = CounterContract::default(); - // Define a fixed key for the counter value within the map + pub fn get_count(&self) -> Felt { let key = Word::from([felt!(0), felt!(0), felt!(0), felt!(1)]); - // Read the value associated with the key from the storage map - contract.count_map.get(&key) + self.count_map.get(&key) } /// Increments the counter value stored in the contract's storage map by one. - fn increment_count() -> Felt { - // Get the instance of the contract - let contract = CounterContract::default(); - // Define the same fixed key + pub fn increment_count(&self) -> Felt { let key = Word::from([felt!(0), felt!(0), felt!(0), felt!(1)]); - // Read the current value - let current_value: Felt = contract.count_map.get(&key); - // Increment the value by one + let current_value: Felt = self.count_map.get(&key); let new_value = current_value + felt!(1); - // Write the new value back to the storage map - contract.count_map.set(key, new_value); + self.count_map.set(key, new_value); new_value } } diff --git a/examples/counter-contract/wit/counter.wit b/examples/counter-contract/wit/counter.wit deleted file mode 100644 index 214ba623d..000000000 --- a/examples/counter-contract/wit/counter.wit +++ /dev/null @@ -1,17 +0,0 @@ -package miden:counter-contract@0.1.0; - -use miden:base/core-types@1.0.0; - -interface counter { - use core-types.{felt}; - - /// Returns the current counter value stored in the contract's storage. - get-count: func() -> felt; - /// Increments the counter value stored in the contract's storage by one - //and return the new counter value - increment-count: func() -> felt; -} - -world counter-world { - export counter; -} diff --git a/examples/counter-note/Cargo.toml b/examples/counter-note/Cargo.toml index 33aa1aed5..d4fe17164 100644 --- a/examples/counter-note/Cargo.toml +++ b/examples/counter-note/Cargo.toml @@ -27,7 +27,8 @@ package = "miden:counter-note" "miden:counter-contract" = { path = "../counter-contract" } [package.metadata.component.target.dependencies] -"miden:counter-contract" = { path = "../counter-contract/wit/counter.wit" } +"miden:counter-account" = { path = "../counter-contract/target/generated-wit/" } + [profile.release] trim-paths = ["diagnostics", "object"] diff --git a/examples/counter-note/src/lib.rs b/examples/counter-note/src/lib.rs index ca8c973df..8c2ae6f5a 100644 --- a/examples/counter-note/src/lib.rs +++ b/examples/counter-note/src/lib.rs @@ -9,13 +9,13 @@ use miden::*; -use crate::bindings::miden::counter_contract::counter; +use crate::bindings::miden::counter_contract::counter_contract; #[note_script] fn run(_arg: Word) { - let initial_value = counter::get_count(); - counter::increment_count(); + let initial_value = counter_contract::get_count(); + counter_contract::increment_count(); let expected_value = initial_value + Felt::from_u32(1); - let final_value = counter::get_count(); + let final_value = counter_contract::get_count(); assert_eq(final_value, expected_value); } diff --git a/tests/integration-node/src/local_node/setup.rs b/tests/integration-node/src/local_node/setup.rs index 51ecbfec7..5e3d32286 100644 --- a/tests/integration-node/src/local_node/setup.rs +++ b/tests/integration-node/src/local_node/setup.rs @@ -11,7 +11,7 @@ use super::{process::kill_process, sync::read_pid, COORD_DIR}; // 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.0"; +const MIDEN_NODE_VERSION: &str = "0.12.2"; /// Manages the lifecycle of a local Miden node instance pub struct LocalMidenNode; diff --git a/tests/integration-node/src/node_tests/counter_contract.rs b/tests/integration-node/src/node_tests/counter_contract.rs index c1d792450..32e210d42 100644 --- a/tests/integration-node/src/node_tests/counter_contract.rs +++ b/tests/integration-node/src/node_tests/counter_contract.rs @@ -100,28 +100,8 @@ pub fn test_counter_contract_local() { .build() .unwrap(); - let tx_result = client - .execute_transaction(counter_account.id(), note_request) - .await - .map_err(|e| { - eprintln!("Transaction creation error: {e}"); - e - }) - .unwrap(); - let executed_transaction = tx_result.executed_transaction(); - // dbg!(executed_transaction.output_notes()); - - 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(); + 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 @@ -130,25 +110,10 @@ pub fn test_counter_contract_local() { .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()) + let _consume_tx_id = client + .submit_new_transaction(counter_account.id(), consume_request) .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); diff --git a/tests/integration/expected/examples/counter.hir b/tests/integration/expected/examples/counter.hir index 8d02ac4c7..62654e8b1 100644 --- a/tests/integration/expected/examples/counter.hir +++ b/tests/integration/expected/examples/counter.hir @@ -1,4 +1,4 @@ -builtin.component miden:counter-contract/counter@0.1.0 { +builtin.component miden:counter-contract/counter-contract@0.1.0 { builtin.module public @counter_contract { private builtin.function @__wasm_call_ctors() { ^block5: @@ -7,16 +7,16 @@ builtin.component miden:counter-contract/counter@0.1.0 { private builtin.function @miden_base_sys::bindings::storage::get_map_item(v0: i32, v1: i32) { ^block7(v0: i32, v1: i32): - v3 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + 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@0.1.0/counter_contract/__stack_pointer : ptr + 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@0.1.0/counter_contract/>::from(v2) : felt + 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]; @@ -47,7 +47,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { hir.assertz v35 #[code = 250]; v36 = hir.int_to_ptr v33 : ptr; v37 = hir.load v36 : felt; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::active_account::get_map_item(v11, v18, v25, v32, v37, v7) + 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]; @@ -80,10 +80,10 @@ builtin.component miden:counter-contract/counter@0.1.0 { hir.store v61, v55; v62 = arith.constant 16 : i32; v63 = arith.add v7, v62 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v0, v63) + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v0, v63) v490 = arith.constant 32 : i32; v65 = arith.add v7, v490 : i32 #[overflow = wrapping]; - v66 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + 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; builtin.ret ; @@ -94,25 +94,25 @@ builtin.component miden:counter-contract/counter@0.1.0 { builtin.ret ; }; - private builtin.function @miden:counter-contract/counter@0.1.0#get-count() -> felt { + private builtin.function @miden:counter-contract/counter-contract@0.1.0#get-count() -> felt { ^block11: - v71 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + 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@0.1.0/counter_contract/__stack_pointer : ptr + 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; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/wit_bindgen::rt::run_ctors_once() + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v69) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v507) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v506) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v84) : felt + 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]; @@ -145,7 +145,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { hir.store v107, v79; v108 = arith.constant 16 : i32; v109 = arith.add v75, v108 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v109, v75) + 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]; @@ -156,31 +156,31 @@ builtin.component miden:counter-contract/counter@0.1.0 { 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@0.1.0/counter_contract/__stack_pointer : ptr + 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; }; - private builtin.function @miden:counter-contract/counter@0.1.0#increment-count() -> felt { + private builtin.function @miden:counter-contract/counter-contract@0.1.0#increment-count() -> felt { ^block13: - v124 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + 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 128 : i32; v128 = arith.sub v126, v127 : i32 #[overflow = wrapping]; - v129 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + 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; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/wit_bindgen::rt::run_ctors_once() + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v122) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v530) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v529) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v137) : felt + 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]; @@ -213,7 +213,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { hir.store v160, v132; v161 = arith.constant 64 : i32; v162 = arith.add v128, v161 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v162, v128) + 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]; @@ -223,13 +223,13 @@ builtin.component miden:counter-contract/counter@0.1.0 { v170 = hir.int_to_ptr v167 : ptr; v171 = hir.load v170 : felt; v523 = arith.constant 1 : i32; - v173 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v523) : felt - v174 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::add(v171, v173) : felt + 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@0.1.0/counter_contract/>::from(v164, v174) + 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@0.1.0/counter_contract/>::from(v522) : felt + 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]; @@ -264,7 +264,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { v204 = hir.load v203 : felt; v517 = arith.constant 64 : i32; v206 = arith.add v128, v517 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::native_account::set_map_item(v176, v138, v136, v134, v132, v183, v190, v197, v204, v206) + 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]; @@ -333,15 +333,15 @@ builtin.component miden:counter-contract/counter@0.1.0 { 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@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v260, v262) + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v260, v262) v265 = arith.constant 112 : i32; v266 = arith.add v128, v265 : i32 #[overflow = wrapping]; v263 = arith.constant 32 : i32; v264 = arith.add v128, v263 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v264, v266) + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v264, v266) v508 = arith.constant 128 : i32; v268 = arith.add v128, v508 : i32 #[overflow = wrapping]; - v269 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + 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; @@ -349,7 +349,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v272 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + 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; @@ -366,10 +366,10 @@ builtin.component miden:counter-contract/counter@0.1.0 { scf.yield ; } else { ^block18: - v284 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + 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; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/__wasm_call_ctors() + 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]; @@ -391,7 +391,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v299: i32, v300: i32) { ^block21(v299: i32, v300: i32): - v303 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v303 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr v304 = hir.bitcast v303 : ptr; v305 = hir.load v304 : i32; v306 = arith.constant 16 : i32; @@ -519,11 +519,11 @@ builtin.component miden:counter-contract/counter@0.1.0 { 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v391) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v627) : felt + 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@0.1.0/counter_contract/intrinsics::felt::from_u32(v626) : felt + 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]; @@ -640,13 +640,13 @@ builtin.component miden:counter-contract/counter@0.1.0 { public builtin.function @get-count() -> felt { ^block40: - v488 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#get-count() : felt + 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; }; public builtin.function @increment-count() -> felt { ^block42: - v489 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#increment-count() : felt + 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; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/counter.masm b/tests/integration/expected/examples/counter.masm index ac1d4d356..77675958d 100644 --- a/tests/integration/expected/examples/counter.masm +++ b/tests/integration/expected/examples/counter.masm @@ -1,13 +1,13 @@ -# mod miden:counter-contract/counter@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@0.1.0::init + exec.::miden:counter-contract/counter-contract@0.1.0::init trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden:counter-contract/counter@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 @@ -17,10 +17,10 @@ end pub proc increment-count( ) -> felt - exec.::miden:counter-contract/counter@0.1.0::init + exec.::miden:counter-contract/counter-contract@0.1.0::init trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden:counter-contract/counter@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 @@ -47,7 +47,7 @@ proc init mem_store.278537 end -# mod miden:counter-contract/counter@0.1.0::counter_contract +# mod miden:counter-contract/counter-contract@0.1.0::counter_contract @callconv("C") proc __wasm_call_ctors( @@ -84,7 +84,7 @@ proc miden_base_sys::bindings::storage::get_map_item( push.0 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::>::from + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::>::from trace.252 nop push.12 @@ -162,7 +162,7 @@ proc miden_base_sys::bindings::storage::get_map_item( swap.5 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::active_account::get_map_item + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden::active_account::get_map_item trace.252 nop push.8 @@ -236,7 +236,7 @@ proc miden_base_sys::bindings::storage::get_map_item( movup.2 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.32 @@ -259,7 +259,7 @@ proc counter_contract::bindings::__link_custom_section_describing_imports( end @callconv("C") -proc miden:counter-contract/counter@0.1.0#get-count( +proc miden:counter-contract/counter-contract@0.1.0#get-count( ) -> felt push.1114144 @@ -284,31 +284,31 @@ proc miden:counter-contract/counter@0.1.0#get-count( nop trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::wit_bindgen::rt::run_ctors_once + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + 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@0.1.0::counter_contract::intrinsics::felt::from_u32 + 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@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 trace.252 nop push.1 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 trace.252 nop push.12 @@ -383,7 +383,7 @@ proc miden:counter-contract/counter@0.1.0#get-count( swap.1 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden_base_sys::bindings::storage::get_map_item + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_base_sys::bindings::storage::get_map_item trace.252 nop push.28 @@ -417,7 +417,7 @@ proc miden:counter-contract/counter@0.1.0#get-count( end @callconv("C") -proc miden:counter-contract/counter@0.1.0#increment-count( +proc miden:counter-contract/counter-contract@0.1.0#increment-count( ) -> felt push.1114144 @@ -442,31 +442,31 @@ proc miden:counter-contract/counter@0.1.0#increment-count( nop trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::wit_bindgen::rt::run_ctors_once + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + 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@0.1.0::counter_contract::intrinsics::felt::from_u32 + 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@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 trace.252 nop push.1 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 trace.252 nop push.12 @@ -549,7 +549,7 @@ proc miden:counter-contract/counter@0.1.0#increment-count( swap.1 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden_base_sys::bindings::storage::get_map_item + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_base_sys::bindings::storage::get_map_item trace.252 nop push.76 @@ -572,13 +572,13 @@ proc miden:counter-contract/counter@0.1.0#increment-count( push.1 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 trace.252 nop swap.1 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::add + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::add trace.252 nop push.48 @@ -588,13 +588,13 @@ proc miden:counter-contract/counter@0.1.0#increment-count( swap.1 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::>::from + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::>::from trace.252 nop push.0 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::>::from + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::>::from trace.252 nop push.60 @@ -681,7 +681,7 @@ proc miden:counter-contract/counter@0.1.0#increment-count( swap.5 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::native_account::set_map_item + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden::native_account::set_map_item trace.252 nop push.72 @@ -827,7 +827,7 @@ proc miden:counter-contract/counter@0.1.0#increment-count( u32wrapping_add trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.112 @@ -838,7 +838,7 @@ proc miden:counter-contract/counter@0.1.0#increment-count( u32wrapping_add trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.128 @@ -897,7 +897,7 @@ proc wit_bindgen::rt::run_ctors_once( nop trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::__wasm_call_ctors + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::__wasm_call_ctors trace.252 nop push.1 @@ -1209,19 +1209,19 @@ proc felt { + private builtin.function @counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0() -> felt { ^block3: - v0 = hir.call : felt #[callee = miden:counter-contract/counter@0.1.0/get-count] #[signature = (result felt)]; + v0 = hir.call : felt #[callee = miden:counter-contract/counter-contract@0.1.0/get-count] #[signature = (result felt)]; builtin.ret v0; }; - private builtin.function @counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0() -> felt { + private builtin.function @counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0() -> felt { ^block6: - v1 = hir.call : felt #[callee = miden:counter-contract/counter@0.1.0/increment-count] #[signature = (result felt)]; + v1 = hir.call : felt #[callee = miden:counter-contract/counter-contract@0.1.0/increment-count] #[signature = (result felt)]; builtin.ret v1; }; @@ -25,12 +25,12 @@ 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::get_count::wit_import0() : felt - v8 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0() : felt + 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 - v12 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0() : felt + 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) builtin.ret ; }; diff --git a/tests/integration/expected/examples/counter_note.masm b/tests/integration/expected/examples/counter_note.masm index 22ca175c3..53b4fbc89 100644 --- a/tests/integration/expected/examples/counter_note.masm +++ b/tests/integration/expected/examples/counter_note.masm @@ -35,23 +35,23 @@ end # mod miden:base/note-script@1.0.0::counter_note @callconv("C") -proc counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0( +proc counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0( ) -> felt trace.240 nop - call.::miden:counter-contract/counter@0.1.0::get-count + call.::miden:counter-contract/counter-contract@0.1.0::get-count trace.252 nop end @callconv("C") -proc counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0( +proc counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0( ) -> felt trace.240 nop - call.::miden:counter-contract/counter@0.1.0::increment-count + call.::miden:counter-contract/counter-contract@0.1.0::increment-count trace.252 nop end @@ -83,12 +83,12 @@ 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::counter_note::counter_note::bindings::miden::counter_contract::counter::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 trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::counter_note::bindings::miden::counter_contract::counter::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 @@ -106,7 +106,7 @@ 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::counter_note::counter_note::bindings::miden::counter_contract::counter::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 trace.240 diff --git a/tests/integration/expected/examples/counter_note.wat b/tests/integration/expected/examples/counter_note.wat index 80fa7215e..547f3fada 100644 --- a/tests/integration/expected/examples/counter_note.wat +++ b/tests/integration/expected/examples/counter_note.wat @@ -19,7 +19,7 @@ (export (;1;) "increment-count" (func (type 2))) ) ) - (import "miden:counter-contract/counter@0.1.0" (instance (;1;) (type 2))) + (import "miden:counter-contract/counter-contract@0.1.0" (instance (;1;) (type 2))) (core module (;0;) (type (;0;) (func (result f32))) (type (;1;) (func)) @@ -27,8 +27,8 @@ (type (;3;) (func (param f32 f32) (result f32))) (type (;4;) (func (param i32) (result f32))) (type (;5;) (func (param f32 f32))) - (import "miden:counter-contract/counter@0.1.0" "get-count" (func $counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 (;0;) (type 0))) - (import "miden:counter-contract/counter@0.1.0" "increment-count" (func $counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0 (;1;) (type 0))) + (import "miden:counter-contract/counter-contract@0.1.0" "get-count" (func $counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 (;0;) (type 0))) + (import "miden:counter-contract/counter-contract@0.1.0" "increment-count" (func $counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0 (;1;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -41,16 +41,16 @@ (func $miden:base/note-script@1.0.0#run (;4;) (type 2) (param f32 f32 f32 f32) (local f32) call $wit_bindgen::rt::run_ctors_once - call $counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 + call $counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 local.set 4 - call $counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0 + call $counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0 drop local.get 4 i32.const 1 call $intrinsics::felt::from_u32 call $intrinsics::felt::add local.set 4 - call $counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 + call $counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 local.get 4 call $intrinsics::felt::assert_eq ) @@ -93,7 +93,7 @@ (export "increment-count" (func 1)) ) (core instance (;1;) (instantiate 0 - (with "miden:counter-contract/counter@0.1.0" (instance 0)) + (with "miden:counter-contract/counter-contract@0.1.0" (instance 0)) ) ) (alias core export 1 "memory" (core memory (;0;))) From 970d2f96c8698409da42c45311933ccdb05eeb8c Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 12 Nov 2025 06:57:01 +0200 Subject: [PATCH 15/70] chore: add a smoke test for `cargo miden new` --- tools/cargo-miden/tests/build.rs | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tools/cargo-miden/tests/build.rs b/tools/cargo-miden/tests/build.rs index 931ba09d0..d4497abe2 100644 --- a/tools/cargo-miden/tests/build.rs +++ b/tools/cargo-miden/tests/build.rs @@ -433,3 +433,74 @@ fn build_new_project_from_template(template: &str) -> Package { fs::remove_dir_all(new_project_path).unwrap(); package } + +#[test] +fn new_project_integration_tests_pass() { + let _ = env_logger::Builder::from_env("MIDENC_TRACE") + .is_test(true) + .format_timestamp(None) + .try_init(); + env::set_var("TEST", "1"); + + let restore_dir = env::current_dir().unwrap(); + let temp_dir = env::temp_dir().join(format!( + "cargo_miden_integration_{}", + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_millis() + )); + if temp_dir.exists() { + fs::remove_dir_all(&temp_dir).unwrap(); + } + fs::create_dir_all(&temp_dir).unwrap(); + env::set_current_dir(&temp_dir).unwrap(); + + let project_name = format!( + "integration_project_{}", + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_micros() + ); + let args = new_project_args(&project_name, ""); + + let output = run(args.into_iter(), OutputType::Masm) + .expect("Failed to create project with `cargo miden new`") + .expect("'cargo miden new' should return Some(CommandOutput)"); + let project_path = match output { + cargo_miden::CommandOutput::NewCommandOutput { project_path } => { + project_path.canonicalize().unwrap() + } + other => panic!("Expected NewCommandOutput, got {other:?}"), + }; + assert!(project_path.exists()); + + let integration_dir = project_path.join("integration"); + assert!( + integration_dir.exists(), + "expected integration workspace at {}", + integration_dir.display() + ); + + let output = std::process::Command::new("cargo") + .arg("test") + .current_dir(&integration_dir) + .output() + .expect("failed to spawn `cargo test` inside integration directory"); + if !output.status.success() { + panic!( + "`cargo test` failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}", + integration_dir.display(), + output.status.code(), + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + } + + env::set_current_dir(restore_dir).unwrap(); + fs::remove_dir_all(&project_path).unwrap(); + if temp_dir.exists() { + fs::remove_dir_all(&temp_dir).unwrap(); + } +} From d7095edf1f4aca1cf728fd31b5c912bbfff46dec Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 20 Nov 2025 17:14:03 -0300 Subject: [PATCH 16/70] chore: run new Miden project test in the separate CI job (space hog) --- .github/workflows/ci.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c0ab962d..1abe68b77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,8 +197,39 @@ jobs: cargo install cargo-make --force fi - name: Test + # Skip running the `new_project_integration_tests_pass` test since it + # is a disc space hog. run: | - cargo make test -E 'package(cargo-miden)' + cargo make test -E 'package(cargo-miden) - test(new_project_integration_tests_pass)' + + cargo_miden_tests_mpt: + name: cargo-miden test Miden project template + runs-on: ubuntu-latest + # We only want to run the integration tests if the unit tests pass, and that has the added + # benefit that we can re-use the cache from the unit test job for all integration tests + needs: [unit_tests] + steps: + - uses: actions/checkout@v5 + - name: Install Rust + run: | + rustup update --no-self-update + rustc --version + - name: Cache Cargo + uses: Swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-shared-tests + prefix-key: ${{ env.RUST_CACHE_KEY }} + # Do not persist the cache, leave that to the unit tests, we just use the cache here + save-if: false + - name: Install cargo-make + run: | + if ! cargo make --version 2>/dev/null; then + cargo install cargo-make --force + fi + - name: Test + run: | + cargo make test -E 'test(new_project_integration_tests_pass)' + miden_integration_node_tests: name: miden integration node tests From 7a6c12b20d6ab2f73633395af90b66b7381e1c5e Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 26 Nov 2025 12:10:47 +0200 Subject: [PATCH 17/70] chore: split CI jobs to run some tests (space hogs) in separate jobs --- .github/workflows/ci.yml | 65 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1abe68b77..1d4ebf3f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,8 +169,39 @@ jobs: cargo install cargo-make --force fi - name: Test + # Skip some tests cause they are a space hog and run them in the separate job run: | - cargo make test -E 'package(miden-integration-tests)' + cargo make test -E 'package(miden-integration-tests) - test(~rust_masm_tests::examples)' + + + midenc_integration_tests_examples: + name: midenc integration tests + runs-on: ubuntu-latest + # We only want to run the integration tests if the unit tests pass, and that has the added + # benefit that we can re-use the cache from the unit test job for all integration tests + needs: [unit_tests] + steps: + - uses: actions/checkout@v5 + - name: Install Rust + run: | + rustup update --no-self-update + rustc --version + - name: Cache Cargo + uses: Swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-shared-tests + prefix-key: ${{ env.RUST_CACHE_KEY }} + # Do not persist the cache, leave that to the unit tests, we just use the cache here + save-if: false + - name: Install cargo-make + run: | + if ! cargo make --version 2>/dev/null; then + cargo install cargo-make --force + fi + - name: Test + # Skip some tests cause they are a space hog and run them in the separate job + run: | + cargo make test -E 'test(~rust_masm_tests::examples)' cargo_miden_integration_tests: name: cargo-miden integration tests @@ -197,10 +228,9 @@ jobs: cargo install cargo-make --force fi - name: Test - # Skip running the `new_project_integration_tests_pass` test since it - # is a disc space hog. + # Skip running the some test since they are a disc space hog. run: | - cargo make test -E 'package(cargo-miden) - test(new_project_integration_tests_pass)' + cargo make test -E 'package(cargo-miden) - test(new_project_integration_tests_pass) - test(test_all_templates_and_examples)' cargo_miden_tests_mpt: name: cargo-miden test Miden project template @@ -230,6 +260,33 @@ jobs: run: | cargo make test -E 'test(new_project_integration_tests_pass)' + cargo_miden_tests_templates_and_examples: + name: cargo-miden test new project templates and examples + runs-on: ubuntu-latest + # We only want to run the integration tests if the unit tests pass, and that has the added + # benefit that we can re-use the cache from the unit test job for all integration tests + needs: [unit_tests] + steps: + - uses: actions/checkout@v5 + - name: Install Rust + run: | + rustup update --no-self-update + rustc --version + - name: Cache Cargo + uses: Swatinem/rust-cache@v2 + with: + shared-key: ${{ github.workflow }}-shared-tests + prefix-key: ${{ env.RUST_CACHE_KEY }} + # Do not persist the cache, leave that to the unit tests, we just use the cache here + save-if: false + - name: Install cargo-make + run: | + if ! cargo make --version 2>/dev/null; then + cargo install cargo-make --force + fi + - name: Test + run: | + cargo make test -E 'test(test_all_templates_and_examples)' miden_integration_node_tests: name: miden integration node tests From 1c86c8c60aeb0ec8911c620e0bdc605ecd45675e Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 27 Nov 2025 15:36:22 +0200 Subject: [PATCH 18/70] chore: fix node integration tests failing with "grpc-status header missing, mapped from HTTP status code 500" errors. The root cause was that the node process was started with `Stdio::piped()` for stdout/stderr, and when the pipe buffers filled up during heavy logging, the node would block on I/O writes, causing gRPC requests to fail. The fix changes the node process to use `Stdio::null()` instead, which prevents blocking. For debugging, users can run the node manually with `RUST_LOG=debug`. --- .github/workflows/ci.yml | 4 +- .../src/local_node/process.rs | 37 +++++-------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d4ebf3f7..4a570b691 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -314,9 +314,7 @@ jobs: fi - name: Test run: | - # Run sequentially as a workaround until - # https://github.com/0xMiden/compiler/issues/766 is resolved - cargo make test -E 'package(miden-integration-node-tests)' --test-threads 1 + cargo make test -E 'package(miden-integration-node-tests)' cargo_publish_dry_run: name: cargo publish dry run diff --git a/tests/integration-node/src/local_node/process.rs b/tests/integration-node/src/local_node/process.rs index 06c01c175..ccf426993 100644 --- a/tests/integration-node/src/local_node/process.rs +++ b/tests/integration-node/src/local_node/process.rs @@ -2,7 +2,6 @@ use std::{ fs::{self, File}, - io::BufRead, net::TcpStream, process::{Command, Stdio}, thread, @@ -95,7 +94,13 @@ pub async fn start_shared_node() -> Result { } // Start the node process - let mut child = Command::new("miden-node") + // 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", @@ -106,37 +111,13 @@ pub async fn start_shared_node() -> Result { "--block.interval", "1sec", ]) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) .spawn() .context("Failed to start miden-node process")?; let pid = child.id(); - // Capture output for debugging - let stdout = child.stdout.take().expect("Failed to capture stdout"); - let stderr = child.stderr.take().expect("Failed to capture stderr"); - - // Check if node output logging is enabled - let enable_node_output = std::env::var("MIDEN_NODE_OUTPUT").unwrap_or_default() == "1"; - - // Spawn threads to read output - thread::spawn(move || { - let reader = std::io::BufReader::new(stdout); - for line in reader.lines().map_while(Result::ok) { - if enable_node_output { - eprintln!("[shared node stdout] {line}"); - } - } - }); - - thread::spawn(move || { - let reader = std::io::BufReader::new(stderr); - for line in reader.lines().map_while(Result::ok) { - eprintln!("[shared node stderr] {line}"); - } - }); - // Detach the child process so it continues running after we exit drop(child); From 1ca976742517ae219b37bbdc0932c0843e5188df Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 28 Nov 2025 13:56:53 +0200 Subject: [PATCH 19/70] chore: remove unused tools in the GA runner image to free up disc space --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a570b691..c540622f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -59,6 +64,11 @@ jobs: if: ${{ always() }} steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -85,6 +95,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -117,6 +132,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -152,6 +172,11 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -182,6 +207,11 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -211,6 +241,11 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -240,6 +275,11 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -268,6 +308,11 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -296,6 +341,11 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update @@ -322,6 +372,11 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 + - name: Remove unused tools in the runner image + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true - name: Install Rust run: | rustup update --no-self-update From 051fa30368ec2e52eb4771c04e2c4fa4b48c9710 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 28 Nov 2025 14:58:34 +0200 Subject: [PATCH 20/70] refactor: use composite action for "remove unused tools" step --- .github/actions/cleanup-runner/action.yml | 12 +++++ .github/workflows/ci.yml | 66 ++++------------------- 2 files changed, 23 insertions(+), 55 deletions(-) create mode 100644 .github/actions/cleanup-runner/action.yml diff --git a/.github/actions/cleanup-runner/action.yml b/.github/actions/cleanup-runner/action.yml new file mode 100644 index 000000000..22edac443 --- /dev/null +++ b/.github/actions/cleanup-runner/action.yml @@ -0,0 +1,12 @@ +name: 'Cleanup Runner' +description: 'Remove unused tools in the runner image to free disk space' + +runs: + using: 'composite' + steps: + - name: Remove unused tools in the runner image + shell: bash + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + sudo docker builder prune -a --force || true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c540622f3..278cc8aec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,11 +30,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -64,11 +60,7 @@ jobs: if: ${{ always() }} steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -95,11 +87,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -132,11 +120,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -172,11 +156,7 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -207,11 +187,7 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -241,11 +217,7 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -275,11 +247,7 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -308,11 +276,7 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -341,11 +305,7 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update @@ -372,11 +332,7 @@ jobs: needs: [unit_tests] steps: - uses: actions/checkout@v5 - - name: Remove unused tools in the runner image - run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force || true - sudo docker builder prune -a --force || true + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update From ca72854e818c7123060fd9c862087bb1723d4845 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 20 Oct 2025 14:22:05 +0300 Subject: [PATCH 21/70] feature(cargo-miden): passthrough unknown options in `cargo miden build` to midenc --- tools/cargo-miden/src/commands/build.rs | 72 +++- tools/cargo-miden/src/config.rs | 450 ++++++++++++++++++------ 2 files changed, 413 insertions(+), 109 deletions(-) diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index d580469ad..1b52090cd 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -33,11 +33,9 @@ pub struct BuildCommand { impl BuildCommand { /// Executes `cargo miden build`, returning the resulting command output. pub fn exec(self, build_output_type: OutputType) -> Result> { - let mut invocation = Vec::with_capacity(self.cargo_args.len() + 1); - invocation.push("build".to_string()); - invocation.extend(self.cargo_args); - - let cargo_args = CargoArguments::parse_from(invocation.clone().into_iter())?; + let raw_cargo_args = self.cargo_args; + let (cargo_args, passthrough_args) = + CargoArguments::parse_from_with_passthrough(raw_cargo_args.into_iter())?; let metadata = load_metadata(cargo_args.manifest_path.as_deref())?; let mut packages = @@ -61,14 +59,15 @@ impl BuildCommand { let dependency_packages_paths = process_miden_dependencies(cargo_package, &cargo_args)?; - let mut spawn_args: Vec<_> = invocation.clone(); - spawn_args.extend_from_slice( - &[ + let mut spawn_args = cargo_args.to_cargo_build_args(); + spawn_args.extend( + [ "-Z", "build-std=std,core,alloc,panic_abort", "-Z", "build-std-features=panic_immediate_abort", ] + .into_iter() .map(|s| s.to_string()), ); @@ -128,6 +127,8 @@ impl BuildCommand { midenc_flags.push(dep_path.to_string_lossy().to_string()); } + midenc_flags = merge_midenc_flags(midenc_flags, passthrough_args); + match build_output_type { OutputType::Wasm => Ok(Some(CommandOutput::BuildCommandOutput { output: BuildOutput::Wasm { @@ -163,6 +164,61 @@ impl BuildCommand { } } +/// Removes conflicting defaults from `base` and appends passthrough arguments, ensuring the +/// resulting flag list is accepted by the `midenc` frontend. +fn merge_midenc_flags(mut base: Vec, passthrough: Vec) -> Vec { + if passthrough.is_empty() { + return base; + } + + let mut iter = passthrough.into_iter().peekable(); + while let Some(arg) = iter.next() { + match arg.as_str() { + "--lib" | "--exe" => { + remove_flag(&mut base, "--lib"); + remove_flag(&mut base, "--exe"); + base.push(arg); + } + "--entrypoint" => { + remove_entrypoint(&mut base); + base.push(arg); + if let Some(next) = iter.peek() { + if !next.starts_with('-') || next == "-" { + base.push(iter.next().unwrap()); + } + } + } + _ if arg.starts_with("--entrypoint=") => { + remove_entrypoint(&mut base); + base.push(arg); + } + _ => base.push(arg), + } + } + + base +} + +fn remove_flag(flags: &mut Vec, needle: &str) { + flags.retain(|flag| flag != needle); +} + +fn remove_entrypoint(flags: &mut Vec) { + let mut i = 0; + while i < flags.len() { + if flags[i] == "--entrypoint" { + flags.remove(i); + if i < flags.len() && !flags[i].starts_with('-') { + flags.remove(i); + } + } else if flags[i].starts_with("--entrypoint=") { + flags.remove(i); + } else { + i += 1; + } + } +} + fn run_cargo( wasi: &str, cargo_args: &CargoArguments, diff --git a/tools/cargo-miden/src/config.rs b/tools/cargo-miden/src/config.rs index 5a6030301..309e60506 100644 --- a/tools/cargo-miden/src/config.rs +++ b/tools/cargo-miden/src/config.rs @@ -239,6 +239,17 @@ struct Args { short: BTreeMap, } +/// Describes the outcome of a parsing attempt. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum ParseStatus { + /// The argument matched one of the known options and was parsed successfully. + Recognized, + /// The argument resembled an option but wasn't among those registered. + Unrecognized, + /// The argument is not an option (positional argument or other token). + NotOption, +} + impl Args { fn flag(self, name: &'static str, short: Option) -> Self { self.insert(Arg::Flag { @@ -304,38 +315,71 @@ impl Args { self } - /// Parses an argument as an option. - /// - /// Returns `Ok(true)` if the argument is an option. - /// - /// Returns `Ok(false)` if the argument is not an option. - fn parse(&mut self, arg: &str, iter: &mut impl Iterator) -> Result { - // Handle short options - if let Some(mut short) = iter_short(arg) { - while let Some(c) = short.next() { - if let Some(option) = self.get_short_mut(c) { - if option.expects_value() { - let value: String = short.parse_remaining(iter).map_err(|_| { - anyhow!("a value is required for '{option}' but none was supplied") - })?; + fn contains_long(&self, name: &str) -> bool { + self.long.contains_key(name) + } + + fn contains_short(&self, short: char) -> bool { + self.short.contains_key(&short) + } + + fn short_expects_value(&self, short: char) -> Option { + self.short.get(&short).map(|&i| self.args[i].expects_value()) + } - // Strip a leading `=` out of the value if present - option - .set_value(value.strip_prefix('=').map(Into::into).unwrap_or(value))?; - return Ok(true); + /// Parses an argument as an option and reports whether it was recognized. + fn parse(&mut self, arg: &str, iter: &mut impl Iterator) -> Result { + // Handle short options + if iter_short(arg).is_some() { + let mut recognized = true; + if let Some(mut probe) = iter_short(arg) { + for c in &mut probe { + if !self.contains_short(c) { + recognized = false; + break; + } + if self.short_expects_value(c).unwrap_or(false) { + break; } + } + } - option.set_present()?; + if !recognized { + return Ok(ParseStatus::Unrecognized); + } + + let mut short = iter_short(arg).unwrap(); + while let Some(c) = short.next() { + let Some(option) = self.get_short_mut(c) else { + continue; + }; + if option.expects_value() { + let value: String = short.parse_remaining(iter).map_err(|_| { + anyhow!("a value is required for '{option}' but none was supplied") + })?; + + option.set_value(value.strip_prefix('=').map(Into::into).unwrap_or(value))?; + break; } + + option.set_present()?; } - // The argument is an option - return Ok(true); + return Ok(if recognized { + ParseStatus::Recognized + } else { + ParseStatus::Unrecognized + }); } // Handle long options if arg.starts_with("--") { - if let Some(option) = self.get_mut(arg.split_once('=').map(|(n, _)| n).unwrap_or(arg)) { + let long_name = arg.split_once('=').map(|(n, _)| n).unwrap_or(arg); + if !self.contains_long(long_name) { + return Ok(ParseStatus::Unrecognized); + } + + if let Some(option) = self.get_mut(long_name) { if option.expects_value() { if let Some(v) = match_arg(option.name(), &arg, iter) { option.set_value(v.map_err(|_| { @@ -347,12 +391,10 @@ impl Args { } } - // The argument is an option - return Ok(true); + return Ok(ParseStatus::Recognized); } - // Not an option - Ok(false) + Ok(ParseStatus::NotOption) } } @@ -409,8 +451,11 @@ impl CargoArguments { Self::parse_from(std::env::args().skip(1)) } - /// Parses the arguments from an iterator. - pub fn parse_from(iter: impl Iterator) -> Result + /// Parses the arguments from an iterator, returning the structured arguments along with any + /// unhandled options that should be forwarded to subsequent compilation stages. + pub fn parse_from_with_passthrough( + iter: impl Iterator, + ) -> Result<(Self, Vec)> where T: Into, { @@ -431,6 +476,7 @@ impl CargoArguments { .flag("--help", Some('h')); let mut iter = iter.map(Into::into).peekable(); + let mut passthrough = Vec::new(); // Skip the first argument if it is `component` if let Some(arg) = iter.peek() { @@ -440,43 +486,145 @@ impl CargoArguments { } while let Some(arg) = iter.next() { - // Break out of processing at the first `--` if arg == "--" { + passthrough.extend(iter); break; } - // Parse options - if args.parse(&arg, &mut iter)? { - continue; + match args.parse(&arg, &mut iter)? { + ParseStatus::Recognized => continue, + ParseStatus::Unrecognized => { + let is_long = arg.starts_with("--"); + let has_equals = arg.contains('='); + let arg_value = arg; + passthrough.push(arg_value); + + if is_long && !has_equals { + if let Some(next) = iter.peek() { + if !next.starts_with('-') || next == "-" { + passthrough.push(iter.next().unwrap()); + } + } + } + } + ParseStatus::NotOption => { + passthrough.push(arg); + } } } - Ok(Self { - color: args.get_mut("--color").unwrap().take_single().map(|v| v.parse()).transpose()?, - verbose: args.get("--verbose").unwrap().count(), - help: args.get("--help").unwrap().count() > 0, - quiet: args.get("--quiet").unwrap().count() > 0, - manifest_path: args - .get_mut("--manifest-path") - .unwrap() - .take_single() - .map(PathBuf::from), - message_format: args.get_mut("--message-format").unwrap().take_single(), - targets: args.get_mut("--target").unwrap().take_multiple(), - frozen: args.get("--frozen").unwrap().count() > 0, - locked: args.get("--locked").unwrap().count() > 0, - offline: args.get("--offline").unwrap().count() > 0, - release: args.get("--release").unwrap().count() > 0, - workspace: args.get("--workspace").unwrap().count() > 0 - || args.get("--all").unwrap().count() > 0, - packages: args - .get_mut("--package") - .unwrap() - .take_multiple() - .into_iter() - .map(CargoPackageSpec::new) - .collect::>()?, - }) + Ok(( + Self { + color: args + .get_mut("--color") + .unwrap() + .take_single() + .map(|v| v.parse()) + .transpose()?, + verbose: args.get("--verbose").unwrap().count(), + help: args.get("--help").unwrap().count() > 0, + quiet: args.get("--quiet").unwrap().count() > 0, + manifest_path: args + .get_mut("--manifest-path") + .unwrap() + .take_single() + .map(PathBuf::from), + message_format: args.get_mut("--message-format").unwrap().take_single(), + targets: args.get_mut("--target").unwrap().take_multiple(), + frozen: args.get("--frozen").unwrap().count() > 0, + locked: args.get("--locked").unwrap().count() > 0, + offline: args.get("--offline").unwrap().count() > 0, + release: args.get("--release").unwrap().count() > 0, + workspace: args.get("--workspace").unwrap().count() > 0 + || args.get("--all").unwrap().count() > 0, + packages: args + .get_mut("--package") + .unwrap() + .take_multiple() + .into_iter() + .map(CargoPackageSpec::new) + .collect::>()?, + }, + passthrough, + )) + } + + /// Parses the arguments from an iterator. + pub fn parse_from(iter: impl Iterator) -> Result + where + T: Into, + { + let (args, _) = Self::parse_from_with_passthrough(iter)?; + Ok(args) + } + + /// Builds the canonical argument vector forwarded to an underlying `cargo build` invocation. + pub fn to_cargo_build_args(&self) -> Vec { + let mut args = Vec::new(); + args.push("build".to_string()); + + if let Some(color) = self.color { + args.push("--color".to_string()); + args.push(color_choice_as_str(color).to_string()); + } + + for _ in 0..self.verbose { + args.push("--verbose".to_string()); + } + + if self.help { + args.push("--help".to_string()); + } + if self.quiet { + args.push("--quiet".to_string()); + } + + for target in &self.targets { + args.push("--target".to_string()); + args.push(target.clone()); + } + + if let Some(manifest_path) = self.manifest_path.as_ref() { + args.push("--manifest-path".to_string()); + args.push(manifest_path.to_string_lossy().to_string()); + } + + if let Some(format) = self.message_format.as_ref() { + args.push("--message-format".to_string()); + args.push(format.clone()); + } + + if self.frozen { + args.push("--frozen".to_string()); + } + if self.locked { + args.push("--locked".to_string()); + } + if self.release { + args.push("--release".to_string()); + } + if self.offline { + args.push("--offline".to_string()); + } + if self.workspace { + args.push("--workspace".to_string()); + } + + for package in &self.packages { + args.push("--package".to_string()); + args.push(package.to_string()); + } + + args + } +} + +fn color_choice_as_str(choice: ColorChoice) -> &'static str { + match choice { + ColorChoice::Always => "always", + ColorChoice::AlwaysAnsi => "always-ansi", + ColorChoice::Auto => "auto", + ColorChoice::Never => "never", } } @@ -491,12 +639,18 @@ mod test { let mut args = Args::default().flag("--flag", Some('f')); // Test not the flag - args.parse("--not-flag", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--not-flag", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get("--flag").unwrap(); assert_eq!(arg.count(), 0); // Test the flag - args.parse("--flag", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--flag", &mut empty::()), + Ok(ParseStatus::Recognized) + )); assert_eq!( args.parse("--flag", &mut empty::()).unwrap_err().to_string(), "the argument '--flag' cannot be used multiple times" @@ -506,16 +660,27 @@ mod test { arg.reset(); // Test not the short flag - args.parse("-rxd", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("-rxd", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get("--flag").unwrap(); assert_eq!(arg.count(), 0); // Test the short flag - args.parse("-rfx", &mut empty::()).unwrap(); + assert!(matches!(args.parse("-f", &mut empty::()), Ok(ParseStatus::Recognized))); + assert!(matches!( + args.parse("-fx", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); assert_eq!( - args.parse("-fxz", &mut empty::()).unwrap_err().to_string(), + args.parse("-f", &mut empty::()).unwrap_err().to_string(), "the argument '--flag' cannot be used multiple times" ); + assert!(matches!( + args.parse("-fxz", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get("--flag").unwrap(); assert_eq!(arg.count(), 1); @@ -528,7 +693,10 @@ mod test { let mut args = Args::default().single("--option", "VALUE", Some('o')); // Test not the option - args.parse("--not-option", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--not-option", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get_mut("--option").unwrap(); assert_eq!(arg.take_single(), None); @@ -539,7 +707,10 @@ mod test { ); // Test the option with equals - args.parse("--option=value", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--option=value", &mut empty::()), + Ok(ParseStatus::Recognized) + )); assert_eq!( args.parse("--option=value", &mut empty::()).unwrap_err().to_string(), "the argument '--option ' cannot be used multiple times" @@ -550,7 +721,7 @@ mod test { // Test the option with space let mut iter = ["value".to_string()].into_iter(); - args.parse("--option", &mut iter).unwrap(); + assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); assert!(iter.next().is_none()); let mut iter = ["value".to_string()].into_iter(); assert_eq!( @@ -562,28 +733,37 @@ mod test { arg.reset(); // Test not the short option - args.parse("-xyz", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("-zo", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get_mut("--option").unwrap(); assert_eq!(arg.take_single(), None); assert_eq!( - args.parse("-fo", &mut empty::()).unwrap_err().to_string(), + args.parse("-o", &mut empty::()).unwrap_err().to_string(), "a value is required for '--option ' but none was supplied" ); // Test the short option without equals - args.parse("-xofoo", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("-ofoo", &mut empty::()), + Ok(ParseStatus::Recognized) + )); assert_eq!( - args.parse("-zyobar", &mut iter).unwrap_err().to_string(), + args.parse("-obar", &mut empty::()).unwrap_err().to_string(), "the argument '--option ' cannot be used multiple times" ); let arg = args.get_mut("--option").unwrap(); assert_eq!(arg.take_single(), Some(String::from("foo"))); // Test the short option with equals - args.parse("-xo=foo", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("-o=foo", &mut empty::()), + Ok(ParseStatus::Recognized) + )); assert_eq!( - args.parse("-zyo=bar", &mut iter).unwrap_err().to_string(), + args.parse("-o=bar", &mut empty::()).unwrap_err().to_string(), "the argument '--option ' cannot be used multiple times" ); let arg = args.get_mut("--option").unwrap(); @@ -591,17 +771,23 @@ mod test { // Test the short option with space let mut iter = ["value".to_string()].into_iter(); - args.parse("-xo", &mut iter).unwrap(); + assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); let mut iter = ["value".to_string()].into_iter(); assert_eq!( - args.parse("-zyo", &mut iter).unwrap_err().to_string(), + args.parse("-o", &mut iter).unwrap_err().to_string(), "the argument '--option ' cannot be used multiple times" ); let arg = args.get_mut("--option").unwrap(); assert_eq!(arg.take_single(), Some(String::from("value"))); // Test it prints correctly - assert_eq!(arg.to_string(), "--option ") + assert_eq!(arg.to_string(), "--option "); + + // Unknown short options should be treated as passthrough. + assert!(matches!( + args.parse("-zo", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); } #[test] @@ -609,7 +795,10 @@ mod test { let mut args = Args::default().multiple("--option", "VALUE", Some('o')); // Test not the option - args.parse("--not-option", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--not-option", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get_mut("--option").unwrap(); assert_eq!(arg.take_multiple(), Vec::::new()); @@ -620,9 +809,18 @@ mod test { ); // Test the option with equals - args.parse("--option=foo", &mut empty::()).unwrap(); - args.parse("--option=bar", &mut empty::()).unwrap(); - args.parse("--option=baz", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--option=foo", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("--option=bar", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("--option=baz", &mut empty::()), + Ok(ParseStatus::Recognized) + )); let arg = args.get_mut("--option").unwrap(); assert_eq!( arg.take_multiple(), @@ -632,13 +830,13 @@ mod test { // Test the option with space let mut iter = ["foo".to_string()].into_iter(); - args.parse("--option", &mut iter).unwrap(); + assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); assert!(iter.next().is_none()); let mut iter = ["bar".to_string()].into_iter(); - args.parse("--option", &mut iter).unwrap(); + assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); assert!(iter.next().is_none()); let mut iter = ["baz".to_string()].into_iter(); - args.parse("--option", &mut iter).unwrap(); + assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); assert!(iter.next().is_none()); let arg = args.get_mut("--option").unwrap(); assert_eq!( @@ -648,20 +846,32 @@ mod test { arg.reset(); // Test not the short option - args.parse("-xyz", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("-xyz", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get_mut("--option").unwrap(); assert_eq!(arg.take_single(), None); // Test missing shot option value assert_eq!( - args.parse("-fo", &mut empty::()).unwrap_err().to_string(), + args.parse("-o", &mut empty::()).unwrap_err().to_string(), "a value is required for '--option ' but none was supplied" ); // Test the short option without equals - args.parse("-xofoo", &mut empty::()).unwrap(); - args.parse("-yobar", &mut empty::()).unwrap(); - args.parse("-zobaz", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("-ofoo", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("-obar", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("-obaz", &mut empty::()), + Ok(ParseStatus::Recognized) + )); let arg = args.get_mut("--option").unwrap(); assert_eq!( arg.take_multiple(), @@ -669,9 +879,18 @@ mod test { ); // Test the short option with equals - args.parse("-xo=foo", &mut empty::()).unwrap(); - args.parse("-yo=bar", &mut empty::()).unwrap(); - args.parse("-zo=baz", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("-o=foo", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("-o=bar", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("-o=baz", &mut empty::()), + Ok(ParseStatus::Recognized) + )); let arg = args.get_mut("--option").unwrap(); assert_eq!( arg.take_multiple(), @@ -680,11 +899,11 @@ mod test { // Test the short option with space let mut iter = ["foo".to_string()].into_iter(); - args.parse("-xo", &mut iter).unwrap(); + assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); let mut iter = ["bar".to_string()].into_iter(); - args.parse("-yo", &mut iter).unwrap(); + assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); let mut iter = ["baz".to_string()].into_iter(); - args.parse("-zo", &mut iter).unwrap(); + assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); let arg = args.get_mut("--option").unwrap(); assert_eq!( arg.take_multiple(), @@ -700,24 +919,43 @@ mod test { let mut args = Args::default().counting("--flag", Some('f')); // Test not the the flag - args.parse("--not-flag", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--not-flag", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); let arg = args.get("--flag").unwrap(); assert_eq!(arg.count(), 0); // Test the flag - args.parse("--flag", &mut empty::()).unwrap(); - args.parse("--flag", &mut empty::()).unwrap(); - args.parse("--flag", &mut empty::()).unwrap(); + assert!(matches!( + args.parse("--flag", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("--flag", &mut empty::()), + Ok(ParseStatus::Recognized) + )); + assert!(matches!( + args.parse("--flag", &mut empty::()), + Ok(ParseStatus::Recognized) + )); let arg = args.get_mut("--flag").unwrap(); assert_eq!(arg.count(), 3); arg.reset(); // Test the short flag - args.parse("-xfzf", &mut empty::()).unwrap(); - args.parse("-pfft", &mut empty::()).unwrap(); - args.parse("-abcd", &mut empty::()).unwrap(); + assert!(matches!(args.parse("-f", &mut empty::()), Ok(ParseStatus::Recognized))); + assert!(matches!(args.parse("-f", &mut empty::()), Ok(ParseStatus::Recognized))); let arg = args.get_mut("--flag").unwrap(); - assert_eq!(arg.count(), 4); + assert_eq!(arg.count(), 2); + arg.reset(); + + assert!(matches!( + args.parse("-fx", &mut empty::()), + Ok(ParseStatus::Unrecognized) + )); + let arg = args.get_mut("--flag").unwrap(); + assert_eq!(arg.count(), 0); // Test it prints correctly assert_eq!(arg.to_string(), "--flag") @@ -802,4 +1040,14 @@ mod test { } ); } + + #[test] + fn it_collects_passthrough_arguments() { + let (args, passthrough) = CargoArguments::parse_from_with_passthrough( + ["--release", "--emit", "ALL=out"].into_iter(), + ) + .unwrap(); + assert!(args.release); + assert_eq!(passthrough, vec!["--emit".to_string(), "ALL=out".to_string()]); + } } From 78e5faa561dfff49576991fe23dae6a269e9fa32 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 21 Oct 2025 11:57:50 +0300 Subject: [PATCH 22/70] refactor: log `midenc` arguments on `cargo miden build` --- tools/cargo-miden/src/compile_masm.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/cargo-miden/src/compile_masm.rs b/tools/cargo-miden/src/compile_masm.rs index 1709d9d2e..6e2c7469c 100644 --- a/tools/cargo-miden/src/compile_masm.rs +++ b/tools/cargo-miden/src/compile_masm.rs @@ -45,6 +45,7 @@ pub fn wasm_to_masm( ]; args.append(&mut midenc_args); + log::debug!("midenc arguments: {}", &args.join(" ")); let session = Rc::new(Compiler::new_session([input], None, args)); let context = Rc::new(Context::new(session)); println!("Creating Miden package {}", output_file.display()); From b1ca983d09968e5ff790f0932dd6c8e63616ea5f Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 28 Nov 2025 17:13:31 +0200 Subject: [PATCH 23/70] refactor: `cargo miden build` to parse all command-line arguments through the `midenc` compiler's `Compiler` struct instead of using a separate custom argument parser. This adds hidden cargo-specific options (`--release`, `--manifest-path`, `--workspace`, `--package`) to the `Compiler` struct in `midenc-compile`, which are recognized by `cargo miden build` and forwarded to the underlying `cargo build` invocation. The midenc options (currently only `--emit`) are passed to the compilation stage. --- midenc-compile/src/compiler.rs | 37 + tools/cargo-miden/src/commands/build.rs | 296 ++++---- tools/cargo-miden/src/commands/mod.rs | 2 +- tools/cargo-miden/src/config.rs | 957 +----------------------- tools/cargo-miden/src/dependencies.rs | 6 +- 5 files changed, 209 insertions(+), 1089 deletions(-) diff --git a/midenc-compile/src/compiler.rs b/midenc-compile/src/compiler.rs index ccf197415..658cae944 100644 --- a/midenc-compile/src/compiler.rs +++ b/midenc-compile/src/compiler.rs @@ -271,6 +271,21 @@ pub struct Compiler { ) )] pub unstable: Vec, + + // The following options are primarily used by `cargo miden build` to pass through + // familiar Cargo options. They are hidden from `midenc --help` output. + /// Build in release mode (used by cargo miden build) + #[cfg_attr(feature = "std", arg(long, hide = true, default_value_t = false))] + pub release: bool, + /// Path to Cargo.toml (used by cargo miden build) + #[cfg_attr(feature = "std", arg(long, value_name = "PATH", hide = true))] + pub manifest_path: Option, + /// Build all packages in the workspace (used by cargo miden build) + #[cfg_attr(feature = "std", arg(long, hide = true, default_value_t = false))] + pub workspace: bool, + /// Package(s) to build (used by cargo miden build) + #[cfg_attr(feature = "std", arg(long, value_name = "SPEC", hide = true))] + pub package: Vec, } #[derive(Default, Debug, Clone)] @@ -435,6 +450,28 @@ NOTE: When specifying these options, strip the leading '--'", } impl Compiler { + /// Parse compiler options from command-line arguments. + /// + /// Returns the parsed options or an error if parsing failed. + /// This is used by `cargo miden build` to parse all arguments into `Compiler` + /// options before selectively forwarding them to `cargo build` and `midenc`. + #[cfg(feature = "std")] + pub fn try_parse_from(iter: I) -> Result + where + I: IntoIterator, + T: Into + Clone, + { + let argv = [OsString::from("midenc")] + .into_iter() + .chain(iter.into_iter().map(|arg| arg.into())); + let command = ::command(); + let command = midenc_session::flags::register_flags(command); + let mut matches = command.try_get_matches_from(argv)?; + + ::from_arg_matches_mut(&mut matches) + .map_err(format_error::) + } + /// Construct a [Compiler] programatically #[cfg(feature = "std")] pub fn new_session(inputs: I, emitter: Option>, argv: A) -> Session diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index 1b52090cd..7925b1921 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -7,12 +7,13 @@ use std::{ use anyhow::{bail, Context, Result}; use cargo_metadata::{camino, Artifact, Message, Metadata, MetadataCommand, Package}; use clap::Args; +use midenc_compile::Compiler; use midenc_session::TargetEnv; use path_absolutize::Absolutize; use crate::{ compile_masm, - config::{CargoArguments, CargoPackageSpec}, + config::CargoPackageSpec, dependencies::process_miden_dependencies, target::{self, install_wasm32_target}, BuildOutput, CommandOutput, OutputType, @@ -20,26 +21,35 @@ use crate::{ /// Command-line arguments accepted by `cargo miden build`. /// -/// We capture all tokens following the `build` subcommand so that the build pipeline can -/// interpret them and forward the appropriate options to Cargo. +/// All arguments following `build` are parsed by the `midenc` compiler's argument parser. +/// Cargo-specific options (`--release`, `--manifest-path`, `--workspace`, `--package`) +/// are recognized and forwarded to the underlying `cargo build` invocation. +/// All other options are passed to `midenc` for compilation. #[derive(Clone, Debug, Args)] #[command(disable_version_flag = true, trailing_var_arg = true)] pub struct BuildCommand { - /// Additional arguments forwarded to the underlying Cargo invocation. - #[arg(value_name = "CARGO_ARG", allow_hyphen_values = true)] - pub cargo_args: Vec, + /// Arguments parsed by midenc (includes cargo-compatible options). + #[arg(value_name = "ARG", allow_hyphen_values = true)] + pub args: Vec, } impl BuildCommand { /// Executes `cargo miden build`, returning the resulting command output. pub fn exec(self, build_output_type: OutputType) -> Result> { - let raw_cargo_args = self.cargo_args; - let (cargo_args, passthrough_args) = - CargoArguments::parse_from_with_passthrough(raw_cargo_args.into_iter())?; - let metadata = load_metadata(cargo_args.manifest_path.as_deref())?; + // Parse all arguments using midenc's Compiler parser. + // This gives us a structured representation of all options. + let compiler_opts = Compiler::try_parse_from(&self.args).map_err(|e| { + // Render the clap error with full formatting (colors, suggestions, etc.) + anyhow::anyhow!("{}", e.render()) + })?; + + // Extract cargo-specific options from parsed Compiler struct + let cargo_opts = CargoOptions::from_compiler(&compiler_opts); + + let metadata = load_metadata(cargo_opts.manifest_path.as_deref())?; let mut packages = - load_component_metadata(&metadata, cargo_args.packages.iter(), cargo_args.workspace)?; + load_component_metadata(&metadata, cargo_opts.packages.iter(), cargo_opts.workspace)?; if packages.is_empty() { bail!( @@ -48,7 +58,7 @@ impl BuildCommand { ); } - let cargo_package = determine_cargo_package(&metadata, &cargo_args)?; + let cargo_package = determine_cargo_package(&metadata, &cargo_opts)?; let target_env = target::detect_target_environment(cargo_package)?; let project_type = target::target_environment_to_project_type(target_env); @@ -57,34 +67,9 @@ impl BuildCommand { packages.push(PackageComponentMetadata::new(cargo_package)?); } - let dependency_packages_paths = process_miden_dependencies(cargo_package, &cargo_args)?; - - let mut spawn_args = cargo_args.to_cargo_build_args(); - spawn_args.extend( - [ - "-Z", - "build-std=std,core,alloc,panic_abort", - "-Z", - "build-std-features=panic_immediate_abort", - ] - .into_iter() - .map(|s| s.to_string()), - ); - - let cfg_pairs: Vec<(&str, &str)> = vec![ - ("profile.dev.panic", "\"abort\""), - ("profile.dev.opt-level", "1"), - ("profile.dev.overflow-checks", "false"), - ("profile.dev.debug", "true"), - ("profile.dev.debug-assertions", "false"), - ("profile.release.opt-level", "\"z\""), - ("profile.release.panic", "\"abort\""), - ]; - - for (key, value) in cfg_pairs { - spawn_args.push("--config".to_string()); - spawn_args.push(format!("{key}={value}")); - } + let dependency_packages_paths = process_miden_dependencies(cargo_package, &cargo_opts)?; + + let spawn_args = build_cargo_args(&cargo_opts); // Enable memcopy and 128-bit arithmetic ops let mut extra_rust_flags = String::from("-C target-feature=+bulk-memory,+wide-arithmetic"); @@ -109,7 +94,7 @@ impl BuildCommand { _ => "wasip1", }; - let wasm_outputs = run_cargo(wasi, &cargo_args, &spawn_args)?; + let wasm_outputs = run_cargo(wasi, &spawn_args)?; if let Some(old_rustflags) = maybe_old_rustflags { std::env::set_var("RUSTFLAGS", old_rustflags); @@ -120,14 +105,18 @@ impl BuildCommand { assert_eq!(wasm_outputs.len(), 1, "expected only one Wasm artifact"); let wasm_output = wasm_outputs.first().expect("expected at least one Wasm artifact"); + // Build midenc flags from target environment defaults let mut midenc_flags = midenc_flags_from_target(target_env, project_type, wasm_output); + // Add dependency library paths for dep_path in dependency_packages_paths { midenc_flags.push("--link-library".to_string()); midenc_flags.push(dep_path.to_string_lossy().to_string()); } - midenc_flags = merge_midenc_flags(midenc_flags, passthrough_args); + // Merge user-provided midenc options from parsed Compiler struct + // User options override target-derived defaults + midenc_flags = merge_midenc_flags(midenc_flags, &compiler_opts); match build_output_type { OutputType::Wasm => Ok(Some(CommandOutput::BuildCommandOutput { @@ -138,7 +127,7 @@ impl BuildCommand { })), OutputType::Masm => { let metadata_out_dir = - metadata.target_directory.join("miden").join(if cargo_args.release { + metadata.target_directory.join("miden").join(if cargo_opts.release { "release" } else { "debug" @@ -164,66 +153,131 @@ impl BuildCommand { } } -/// Removes conflicting defaults from `base` and appends passthrough arguments, ensuring the -/// resulting flag list is accepted by the `midenc` frontend. -fn merge_midenc_flags(mut base: Vec, passthrough: Vec) -> Vec { - if passthrough.is_empty() { - return base; - } +/// Cargo-specific options extracted from the `Compiler` struct. +/// +/// These options are recognized by `cargo miden build` and forwarded to the underlying +/// `cargo build` invocation. They are not used by the `midenc` compiler itself. +#[derive(Debug, Default)] +pub struct CargoOptions { + /// Build in release mode + pub release: bool, + /// Path to Cargo.toml + pub manifest_path: Option, + /// Build all packages in the workspace + pub workspace: bool, + /// Packages to build + pub packages: Vec, +} - let mut iter = passthrough.into_iter().peekable(); - while let Some(arg) = iter.next() { - match arg.as_str() { - "--lib" | "--exe" => { - remove_flag(&mut base, "--lib"); - remove_flag(&mut base, "--exe"); - base.push(arg); - } - "--entrypoint" => { - remove_entrypoint(&mut base); - base.push(arg); - if let Some(next) = iter.peek() { - if !next.starts_with('-') || next == "-" { - base.push(iter.next().unwrap()); - } +impl CargoOptions { + /// Extract cargo-specific options from a Compiler struct. + fn from_compiler(compiler: &Compiler) -> Self { + let packages = compiler + .package + .iter() + .filter_map(|s| match CargoPackageSpec::new(s.clone()) { + Ok(spec) => Some(spec), + Err(e) => { + log::warn!("ignoring invalid package spec '{s}': {e}"); + None } - } - _ if arg.starts_with("--entrypoint=") => { - remove_entrypoint(&mut base); - base.push(arg); - } - _ => base.push(arg), + }) + .collect(); + + Self { + release: compiler.release, + manifest_path: compiler.manifest_path.clone(), + workspace: compiler.workspace, + packages, } } - - base } -fn remove_flag(flags: &mut Vec, needle: &str) { - flags.retain(|flag| flag != needle); +/// Builds the argument vector for the underlying `cargo build` invocation. +fn build_cargo_args(cargo_opts: &CargoOptions) -> Vec { + let mut args = vec!["build".to_string()]; + + // Add build-std flags required for Miden compilation + args.extend( + [ + "-Z", + "build-std=std,core,alloc,panic_abort", + "-Z", + "build-std-features=panic_immediate_abort", + ] + .into_iter() + .map(|s| s.to_string()), + ); + + // Configure profile settings + let cfg_pairs: Vec<(&str, &str)> = vec![ + ("profile.dev.panic", "\"abort\""), + ("profile.dev.opt-level", "1"), + ("profile.dev.overflow-checks", "false"), + ("profile.dev.debug", "true"), + ("profile.dev.debug-assertions", "false"), + ("profile.release.opt-level", "\"z\""), + ("profile.release.panic", "\"abort\""), + ]; + + for (key, value) in cfg_pairs { + args.push("--config".to_string()); + args.push(format!("{key}={value}")); + } + + // Forward cargo-specific options + if cargo_opts.release { + args.push("--release".to_string()); + } + + if let Some(ref manifest_path) = cargo_opts.manifest_path { + args.push("--manifest-path".to_string()); + args.push(manifest_path.to_string_lossy().to_string()); + } + + if cargo_opts.workspace { + args.push("--workspace".to_string()); + } + + for package in &cargo_opts.packages { + args.push("--package".to_string()); + args.push(package.to_string()); + } + + args } -fn remove_entrypoint(flags: &mut Vec) { - let mut i = 0; - while i < flags.len() { - if flags[i] == "--entrypoint" { - flags.remove(i); - if i < flags.len() && !flags[i].starts_with('-') { - flags.remove(i); +/// 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() + } } - } else if flags[i].starts_with("--entrypoint=") { - flags.remove(i); - } else { - i += 1; - } + 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, - cargo_args: &CargoArguments, - spawn_args: &[String], -) -> Result> { +fn run_cargo(wasi: &str, spawn_args: &[String]) -> Result> { let cargo_path = std::env::var("CARGO") .map(PathBuf::from) .ok() @@ -237,18 +291,12 @@ fn run_cargo( cargo.arg("--target").arg(format!("wasm32-{wasi}")); - if let Some(format) = &cargo_args.message_format { - if format != "json-render-diagnostics" { - bail!("unsupported cargo message format `{format}`"); - } - } - // It will output the message as json so we can extract the wasm files // that will be componentized cargo.arg("--message-format").arg("json-render-diagnostics"); cargo.stdout(Stdio::piped()); - let artifacts = spawn_cargo(cargo, &cargo_path, cargo_args, true)?; + let artifacts = spawn_cargo(cargo, &cargo_path)?; let outputs: Vec = artifacts .into_iter() @@ -265,12 +313,7 @@ fn run_cargo( Ok(outputs) } -pub fn spawn_cargo( - mut cmd: Command, - cargo: &Path, - cargo_args: &CargoArguments, - process_messages: bool, -) -> Result> { +pub fn spawn_cargo(mut cmd: Command, cargo: &Path) -> Result> { log::debug!("spawning command {cmd:?}"); let mut child = cmd @@ -278,33 +321,26 @@ pub fn spawn_cargo( .context(format!("failed to spawn `{cargo}`", cargo = cargo.display()))?; let mut artifacts = Vec::new(); - if process_messages { - 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 the command line arguments also had `--message-format`, echo the line - if cargo_args.message_format.is_some() { - println!("{line}"); - } + 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; - } + 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, + 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, } } } @@ -324,9 +360,9 @@ pub fn spawn_cargo( fn determine_cargo_package<'a>( metadata: &'a cargo_metadata::Metadata, - cargo_args: &CargoArguments, + cargo_opts: &CargoOptions, ) -> Result<&'a cargo_metadata::Package> { - let package = if let Some(manifest_path) = cargo_args.manifest_path.as_deref() { + let package = if let Some(manifest_path) = cargo_opts.manifest_path.as_deref() { let mp_utf8 = camino::Utf8Path::from_path(manifest_path).ok_or_else(|| { anyhow::anyhow!("manifest path is not valid UTF-8: {}", manifest_path.display()) })?; diff --git a/tools/cargo-miden/src/commands/mod.rs b/tools/cargo-miden/src/commands/mod.rs index a0cd0ce0e..3e8473b4f 100644 --- a/tools/cargo-miden/src/commands/mod.rs +++ b/tools/cargo-miden/src/commands/mod.rs @@ -2,6 +2,6 @@ pub mod build; pub mod example_project; pub mod new_project; -pub use build::BuildCommand; +pub use build::{BuildCommand, CargoOptions}; pub use example_project::ExampleCommand; pub use new_project::NewCommand; diff --git a/tools/cargo-miden/src/config.rs b/tools/cargo-miden/src/config.rs index 309e60506..e84d968a2 100644 --- a/tools/cargo-miden/src/config.rs +++ b/tools/cargo-miden/src/config.rs @@ -18,12 +18,10 @@ //! that `cargo` supports which are necessary for `cargo-component` //! to function. -use std::{collections::BTreeMap, fmt, fmt::Display, path::PathBuf, str::FromStr}; +use std::{fmt, str::FromStr}; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{bail, Context, Result}; use cargo_metadata::Metadata; -use midenc_session::ColorChoice; -use parse_arg::{iter_short, match_arg}; use semver::Version; use toml_edit::DocumentMut; @@ -100,954 +98,3 @@ impl fmt::Display for CargoPackageSpec { Ok(()) } } - -#[derive(Debug, Clone)] -enum Arg { - Flag { - name: &'static str, - short: Option, - value: bool, - }, - Single { - name: &'static str, - value_name: &'static str, - short: Option, - value: Option, - }, - Multiple { - name: &'static str, - value_name: &'static str, - short: Option, - values: Vec, - }, - Counting { - name: &'static str, - short: Option, - value: usize, - }, -} - -impl Arg { - fn name(&self) -> &'static str { - match self { - Self::Flag { name, .. } - | Self::Single { name, .. } - | Self::Multiple { name, .. } - | Self::Counting { name, .. } => name, - } - } - - fn short(&self) -> Option { - match self { - Self::Flag { short, .. } - | Self::Single { short, .. } - | Self::Multiple { short, .. } - | Self::Counting { short, .. } => *short, - } - } - - fn expects_value(&self) -> bool { - matches!(self, Self::Single { .. } | Self::Multiple { .. }) - } - - fn set_value(&mut self, v: String) -> Result<()> { - match self { - Self::Single { value, .. } => { - if value.is_some() { - bail!("the argument '{self}' cannot be used multiple times"); - } - - *value = Some(v); - Ok(()) - } - Self::Multiple { values, .. } => { - values.push(v); - Ok(()) - } - _ => unreachable!(), - } - } - - fn set_present(&mut self) -> Result<()> { - match self { - Self::Flag { value, .. } => { - if *value { - bail!("the argument '{self}' cannot be used multiple times"); - } - - *value = true; - Ok(()) - } - Self::Counting { value, .. } => { - *value += 1; - Ok(()) - } - _ => unreachable!(), - } - } - - fn take_single(&mut self) -> Option { - match self { - Self::Single { value, .. } => value.take(), - _ => None, - } - } - - fn take_multiple(&mut self) -> Vec { - match self { - Self::Multiple { values, .. } => std::mem::take(values), - _ => Vec::new(), - } - } - - fn count(&self) -> usize { - match self { - Arg::Flag { value, .. } => *value as usize, - Arg::Single { value, .. } => value.is_some() as usize, - Arg::Multiple { values, .. } => values.len(), - Arg::Counting { value, .. } => *value, - } - } - - #[cfg(test)] - fn reset(&mut self) { - match self { - Arg::Flag { value, .. } => *value = false, - Arg::Single { value, .. } => *value = None, - Arg::Multiple { values, .. } => values.clear(), - Arg::Counting { value, .. } => *value = 0, - } - } -} - -impl Display for Arg { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{name}", name = self.name())?; - match self { - Self::Single { value_name, .. } | Self::Multiple { value_name, .. } => { - write!(f, " <{value_name}>") - } - _ => Ok(()), - } - } -} - -#[derive(Default, Debug, Clone)] -struct Args { - args: Vec, - long: BTreeMap<&'static str, usize>, - short: BTreeMap, -} - -/// Describes the outcome of a parsing attempt. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -enum ParseStatus { - /// The argument matched one of the known options and was parsed successfully. - Recognized, - /// The argument resembled an option but wasn't among those registered. - Unrecognized, - /// The argument is not an option (positional argument or other token). - NotOption, -} - -impl Args { - fn flag(self, name: &'static str, short: Option) -> Self { - self.insert(Arg::Flag { - name, - short, - value: false, - }) - } - - fn single(self, name: &'static str, value_name: &'static str, short: Option) -> Self { - self.insert(Arg::Single { - name, - value_name, - short, - value: None, - }) - } - - fn multiple(self, name: &'static str, value_name: &'static str, short: Option) -> Self { - self.insert(Arg::Multiple { - name, - value_name, - short, - values: Vec::new(), - }) - } - - fn counting(self, name: &'static str, short: Option) -> Self { - self.insert(Arg::Counting { - name, - short, - value: 0, - }) - } - - fn get(&mut self, name: &str) -> Option<&Arg> { - self.long.get(name).copied().map(|i| &self.args[i]) - } - - fn get_mut(&mut self, name: &str) -> Option<&mut Arg> { - self.long.get(name).copied().map(|i| &mut self.args[i]) - } - - fn get_short_mut(&mut self, short: char) -> Option<&mut Arg> { - self.short.get(&short).copied().map(|i| &mut self.args[i]) - } - - fn insert(mut self, arg: Arg) -> Self { - let name = arg.name(); - let short = arg.short(); - - let index = self.args.len(); - self.args.push(arg); - - let prev = self.long.insert(name, index); - assert!(prev.is_none(), "duplicate argument `{name}` provided"); - - if let Some(short) = short { - let prev = self.short.insert(short, index); - assert!(prev.is_none(), "duplicate argument `-{short}` provided"); - } - - self - } - - fn contains_long(&self, name: &str) -> bool { - self.long.contains_key(name) - } - - fn contains_short(&self, short: char) -> bool { - self.short.contains_key(&short) - } - - fn short_expects_value(&self, short: char) -> Option { - self.short.get(&short).map(|&i| self.args[i].expects_value()) - } - - /// Parses an argument as an option and reports whether it was recognized. - fn parse(&mut self, arg: &str, iter: &mut impl Iterator) -> Result { - // Handle short options - if iter_short(arg).is_some() { - let mut recognized = true; - if let Some(mut probe) = iter_short(arg) { - for c in &mut probe { - if !self.contains_short(c) { - recognized = false; - break; - } - if self.short_expects_value(c).unwrap_or(false) { - break; - } - } - } - - if !recognized { - return Ok(ParseStatus::Unrecognized); - } - - let mut short = iter_short(arg).unwrap(); - while let Some(c) = short.next() { - let Some(option) = self.get_short_mut(c) else { - continue; - }; - if option.expects_value() { - let value: String = short.parse_remaining(iter).map_err(|_| { - anyhow!("a value is required for '{option}' but none was supplied") - })?; - - option.set_value(value.strip_prefix('=').map(Into::into).unwrap_or(value))?; - break; - } - - option.set_present()?; - } - - return Ok(if recognized { - ParseStatus::Recognized - } else { - ParseStatus::Unrecognized - }); - } - - // Handle long options - if arg.starts_with("--") { - let long_name = arg.split_once('=').map(|(n, _)| n).unwrap_or(arg); - if !self.contains_long(long_name) { - return Ok(ParseStatus::Unrecognized); - } - - if let Some(option) = self.get_mut(long_name) { - if option.expects_value() { - if let Some(v) = match_arg(option.name(), &arg, iter) { - option.set_value(v.map_err(|_| { - anyhow!("a value is required for '{option}' but none was supplied") - })?)?; - } - } else if option.name() == arg { - option.set_present()?; - } - } - - return Ok(ParseStatus::Recognized); - } - - Ok(ParseStatus::NotOption) - } -} - -/// Represents known cargo arguments. -/// -/// This is a subset of the arguments that cargo supports that -/// are necessary for cargo-component to function. -#[derive(Default, Debug, Clone, Eq, PartialEq)] -pub struct CargoArguments { - /// The --color argument. - pub color: Option, - /// The (count of) --verbose argument. - pub verbose: usize, - /// The --help argument. - pub help: bool, - /// The --quiet argument. - pub quiet: bool, - /// The --target argument. - pub targets: Vec, - /// The --manifest-path argument. - pub manifest_path: Option, - /// The `--message-format`` argument. - pub message_format: Option, - /// The --frozen argument. - pub frozen: bool, - /// The --locked argument. - pub locked: bool, - /// The --release argument. - pub release: bool, - /// The --offline argument. - pub offline: bool, - /// The --workspace argument. - pub workspace: bool, - /// The --package argument. - pub packages: Vec, -} - -impl CargoArguments { - /// Determines if network access is allowed based on the configuration. - #[allow(unused)] - pub fn network_allowed(&self) -> bool { - !self.frozen && !self.offline - } - - /// Determines if an update to the lock file is allowed based on the configuration. - #[allow(unused)] - pub fn lock_update_allowed(&self) -> bool { - !self.frozen && !self.locked - } - - /// Parses the arguments from the environment. - #[allow(unused)] - pub fn parse() -> Result { - Self::parse_from(std::env::args().skip(1)) - } - - /// Parses the arguments from an iterator, returning the structured arguments along with any - /// unhandled options that should be forwarded to subsequent compilation stages. - pub fn parse_from_with_passthrough( - iter: impl Iterator, - ) -> Result<(Self, Vec)> - where - T: Into, - { - let mut args = Args::default() - .single("--color", "WHEN", Some('c')) - .single("--manifest-path", "PATH", None) - .single("--message-format", "FMT", None) - .multiple("--package", "SPEC", Some('p')) - .multiple("--target", "TRIPLE", None) - .flag("--release", Some('r')) - .flag("--frozen", None) - .flag("--locked", None) - .flag("--offline", None) - .flag("--all", None) - .flag("--workspace", None) - .counting("--verbose", Some('v')) - .flag("--quiet", Some('q')) - .flag("--help", Some('h')); - - let mut iter = iter.map(Into::into).peekable(); - let mut passthrough = Vec::new(); - - // Skip the first argument if it is `component` - if let Some(arg) = iter.peek() { - if arg == "component" { - iter.next().unwrap(); - } - } - - while let Some(arg) = iter.next() { - if arg == "--" { - passthrough.extend(iter); - break; - } - - match args.parse(&arg, &mut iter)? { - ParseStatus::Recognized => continue, - ParseStatus::Unrecognized => { - let is_long = arg.starts_with("--"); - let has_equals = arg.contains('='); - let arg_value = arg; - passthrough.push(arg_value); - - if is_long && !has_equals { - if let Some(next) = iter.peek() { - if !next.starts_with('-') || next == "-" { - passthrough.push(iter.next().unwrap()); - } - } - } - } - ParseStatus::NotOption => { - passthrough.push(arg); - } - } - } - - Ok(( - Self { - color: args - .get_mut("--color") - .unwrap() - .take_single() - .map(|v| v.parse()) - .transpose()?, - verbose: args.get("--verbose").unwrap().count(), - help: args.get("--help").unwrap().count() > 0, - quiet: args.get("--quiet").unwrap().count() > 0, - manifest_path: args - .get_mut("--manifest-path") - .unwrap() - .take_single() - .map(PathBuf::from), - message_format: args.get_mut("--message-format").unwrap().take_single(), - targets: args.get_mut("--target").unwrap().take_multiple(), - frozen: args.get("--frozen").unwrap().count() > 0, - locked: args.get("--locked").unwrap().count() > 0, - offline: args.get("--offline").unwrap().count() > 0, - release: args.get("--release").unwrap().count() > 0, - workspace: args.get("--workspace").unwrap().count() > 0 - || args.get("--all").unwrap().count() > 0, - packages: args - .get_mut("--package") - .unwrap() - .take_multiple() - .into_iter() - .map(CargoPackageSpec::new) - .collect::>()?, - }, - passthrough, - )) - } - - /// Parses the arguments from an iterator. - pub fn parse_from(iter: impl Iterator) -> Result - where - T: Into, - { - let (args, _) = Self::parse_from_with_passthrough(iter)?; - Ok(args) - } - - /// Builds the canonical argument vector forwarded to an underlying `cargo build` invocation. - pub fn to_cargo_build_args(&self) -> Vec { - let mut args = Vec::new(); - args.push("build".to_string()); - - if let Some(color) = self.color { - args.push("--color".to_string()); - args.push(color_choice_as_str(color).to_string()); - } - - for _ in 0..self.verbose { - args.push("--verbose".to_string()); - } - - if self.help { - args.push("--help".to_string()); - } - if self.quiet { - args.push("--quiet".to_string()); - } - - for target in &self.targets { - args.push("--target".to_string()); - args.push(target.clone()); - } - - if let Some(manifest_path) = self.manifest_path.as_ref() { - args.push("--manifest-path".to_string()); - args.push(manifest_path.to_string_lossy().to_string()); - } - - if let Some(format) = self.message_format.as_ref() { - args.push("--message-format".to_string()); - args.push(format.clone()); - } - - if self.frozen { - args.push("--frozen".to_string()); - } - if self.locked { - args.push("--locked".to_string()); - } - if self.release { - args.push("--release".to_string()); - } - if self.offline { - args.push("--offline".to_string()); - } - if self.workspace { - args.push("--workspace".to_string()); - } - - for package in &self.packages { - args.push("--package".to_string()); - args.push(package.to_string()); - } - - args - } -} - -fn color_choice_as_str(choice: ColorChoice) -> &'static str { - match choice { - ColorChoice::Always => "always", - ColorChoice::AlwaysAnsi => "always-ansi", - ColorChoice::Auto => "auto", - ColorChoice::Never => "never", - } -} - -#[cfg(test)] -mod test { - use std::iter::empty; - - use super::*; - - #[test] - fn it_parses_flags() { - let mut args = Args::default().flag("--flag", Some('f')); - - // Test not the flag - assert!(matches!( - args.parse("--not-flag", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get("--flag").unwrap(); - assert_eq!(arg.count(), 0); - - // Test the flag - assert!(matches!( - args.parse("--flag", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert_eq!( - args.parse("--flag", &mut empty::()).unwrap_err().to_string(), - "the argument '--flag' cannot be used multiple times" - ); - let arg = args.get_mut("--flag").unwrap(); - assert_eq!(arg.count(), 1); - arg.reset(); - - // Test not the short flag - assert!(matches!( - args.parse("-rxd", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get("--flag").unwrap(); - assert_eq!(arg.count(), 0); - - // Test the short flag - assert!(matches!(args.parse("-f", &mut empty::()), Ok(ParseStatus::Recognized))); - assert!(matches!( - args.parse("-fx", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - assert_eq!( - args.parse("-f", &mut empty::()).unwrap_err().to_string(), - "the argument '--flag' cannot be used multiple times" - ); - assert!(matches!( - args.parse("-fxz", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get("--flag").unwrap(); - assert_eq!(arg.count(), 1); - - // Test it prints correctly - assert_eq!(arg.to_string(), "--flag") - } - - #[test] - fn it_parses_single_values() { - let mut args = Args::default().single("--option", "VALUE", Some('o')); - - // Test not the option - assert!(matches!( - args.parse("--not-option", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), None); - - // Test missing value - assert_eq!( - args.parse("--option", &mut empty::()).unwrap_err().to_string(), - "a value is required for '--option ' but none was supplied" - ); - - // Test the option with equals - assert!(matches!( - args.parse("--option=value", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert_eq!( - args.parse("--option=value", &mut empty::()).unwrap_err().to_string(), - "the argument '--option ' cannot be used multiple times" - ); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), Some("value".to_string())); - arg.reset(); - - // Test the option with space - let mut iter = ["value".to_string()].into_iter(); - assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); - assert!(iter.next().is_none()); - let mut iter = ["value".to_string()].into_iter(); - assert_eq!( - args.parse("--option", &mut iter).unwrap_err().to_string(), - "the argument '--option ' cannot be used multiple times" - ); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), Some("value".to_string())); - arg.reset(); - - // Test not the short option - assert!(matches!( - args.parse("-zo", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), None); - - assert_eq!( - args.parse("-o", &mut empty::()).unwrap_err().to_string(), - "a value is required for '--option ' but none was supplied" - ); - - // Test the short option without equals - assert!(matches!( - args.parse("-ofoo", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert_eq!( - args.parse("-obar", &mut empty::()).unwrap_err().to_string(), - "the argument '--option ' cannot be used multiple times" - ); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), Some(String::from("foo"))); - - // Test the short option with equals - assert!(matches!( - args.parse("-o=foo", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert_eq!( - args.parse("-o=bar", &mut empty::()).unwrap_err().to_string(), - "the argument '--option ' cannot be used multiple times" - ); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), Some(String::from("foo"))); - - // Test the short option with space - let mut iter = ["value".to_string()].into_iter(); - assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); - let mut iter = ["value".to_string()].into_iter(); - assert_eq!( - args.parse("-o", &mut iter).unwrap_err().to_string(), - "the argument '--option ' cannot be used multiple times" - ); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), Some(String::from("value"))); - - // Test it prints correctly - assert_eq!(arg.to_string(), "--option "); - - // Unknown short options should be treated as passthrough. - assert!(matches!( - args.parse("-zo", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - } - - #[test] - fn it_parses_multiple_values() { - let mut args = Args::default().multiple("--option", "VALUE", Some('o')); - - // Test not the option - assert!(matches!( - args.parse("--not-option", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_multiple(), Vec::::new()); - - // Test missing value - assert_eq!( - args.parse("--option", &mut empty::()).unwrap_err().to_string(), - "a value is required for '--option ' but none was supplied" - ); - - // Test the option with equals - assert!(matches!( - args.parse("--option=foo", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("--option=bar", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("--option=baz", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - let arg = args.get_mut("--option").unwrap(); - assert_eq!( - arg.take_multiple(), - vec!["foo".to_string(), "bar".to_string(), "baz".to_string(),] - ); - arg.reset(); - - // Test the option with space - let mut iter = ["foo".to_string()].into_iter(); - assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); - assert!(iter.next().is_none()); - let mut iter = ["bar".to_string()].into_iter(); - assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); - assert!(iter.next().is_none()); - let mut iter = ["baz".to_string()].into_iter(); - assert!(matches!(args.parse("--option", &mut iter), Ok(ParseStatus::Recognized))); - assert!(iter.next().is_none()); - let arg = args.get_mut("--option").unwrap(); - assert_eq!( - arg.take_multiple(), - vec!["foo".to_string(), "bar".to_string(), "baz".to_string(),] - ); - arg.reset(); - - // Test not the short option - assert!(matches!( - args.parse("-xyz", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get_mut("--option").unwrap(); - assert_eq!(arg.take_single(), None); - - // Test missing shot option value - assert_eq!( - args.parse("-o", &mut empty::()).unwrap_err().to_string(), - "a value is required for '--option ' but none was supplied" - ); - - // Test the short option without equals - assert!(matches!( - args.parse("-ofoo", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("-obar", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("-obaz", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - let arg = args.get_mut("--option").unwrap(); - assert_eq!( - arg.take_multiple(), - vec!["foo".to_string(), "bar".to_string(), "baz".to_string(),] - ); - - // Test the short option with equals - assert!(matches!( - args.parse("-o=foo", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("-o=bar", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("-o=baz", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - let arg = args.get_mut("--option").unwrap(); - assert_eq!( - arg.take_multiple(), - vec!["foo".to_string(), "bar".to_string(), "baz".to_string(),] - ); - - // Test the short option with space - let mut iter = ["foo".to_string()].into_iter(); - assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); - let mut iter = ["bar".to_string()].into_iter(); - assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); - let mut iter = ["baz".to_string()].into_iter(); - assert!(matches!(args.parse("-o", &mut iter), Ok(ParseStatus::Recognized))); - let arg = args.get_mut("--option").unwrap(); - assert_eq!( - arg.take_multiple(), - vec!["foo".to_string(), "bar".to_string(), "baz".to_string(),] - ); - - // Test it prints correctly - assert_eq!(arg.to_string(), "--option ") - } - - #[test] - fn it_parses_counting_flag() { - let mut args = Args::default().counting("--flag", Some('f')); - - // Test not the the flag - assert!(matches!( - args.parse("--not-flag", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get("--flag").unwrap(); - assert_eq!(arg.count(), 0); - - // Test the flag - assert!(matches!( - args.parse("--flag", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("--flag", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - assert!(matches!( - args.parse("--flag", &mut empty::()), - Ok(ParseStatus::Recognized) - )); - let arg = args.get_mut("--flag").unwrap(); - assert_eq!(arg.count(), 3); - arg.reset(); - - // Test the short flag - assert!(matches!(args.parse("-f", &mut empty::()), Ok(ParseStatus::Recognized))); - assert!(matches!(args.parse("-f", &mut empty::()), Ok(ParseStatus::Recognized))); - let arg = args.get_mut("--flag").unwrap(); - assert_eq!(arg.count(), 2); - arg.reset(); - - assert!(matches!( - args.parse("-fx", &mut empty::()), - Ok(ParseStatus::Unrecognized) - )); - let arg = args.get_mut("--flag").unwrap(); - assert_eq!(arg.count(), 0); - - // Test it prints correctly - assert_eq!(arg.to_string(), "--flag") - } - - #[test] - fn it_parses_cargo_arguments() { - let args: CargoArguments = - CargoArguments::parse_from(["component", "build", "--workspace"].into_iter()).unwrap(); - assert_eq!( - args, - CargoArguments { - color: None, - verbose: 0, - help: false, - quiet: false, - targets: Vec::new(), - manifest_path: None, - message_format: None, - release: false, - frozen: false, - locked: false, - offline: false, - workspace: true, - packages: Vec::new(), - } - ); - - let args = CargoArguments::parse_from( - [ - "component", - "publish", - "--help", - "-vvv", - "--color=auto", - "--manifest-path", - "Cargo.toml", - "--message-format", - "json-render-diagnostics", - "--release", - "--package", - "package1", - "-p=package2@1.1.1", - "--target=foo", - "--target", - "bar", - "--quiet", - "--frozen", - "--locked", - "--offline", - "--all", - "--not-an-option", - ] - .into_iter(), - ) - .unwrap(); - assert_eq!( - args, - CargoArguments { - color: Some(ColorChoice::Auto), - verbose: 3, - help: true, - quiet: true, - targets: vec!["foo".to_string(), "bar".to_string()], - manifest_path: Some("Cargo.toml".into()), - message_format: Some("json-render-diagnostics".into()), - release: true, - frozen: true, - locked: true, - offline: true, - workspace: true, - packages: vec![ - CargoPackageSpec { - name: "package1".to_string(), - version: None - }, - CargoPackageSpec { - name: "package2".to_string(), - version: Some(Version::parse("1.1.1").unwrap()) - } - ], - } - ); - } - - #[test] - fn it_collects_passthrough_arguments() { - let (args, passthrough) = CargoArguments::parse_from_with_passthrough( - ["--release", "--emit", "ALL=out"].into_iter(), - ) - .unwrap(); - assert!(args.release); - assert_eq!(passthrough, vec!["--emit".to_string(), "ALL=out".to_string()]); - } -} diff --git a/tools/cargo-miden/src/dependencies.rs b/tools/cargo-miden/src/dependencies.rs index 5d987d0ec..afdc295d5 100644 --- a/tools/cargo-miden/src/dependencies.rs +++ b/tools/cargo-miden/src/dependencies.rs @@ -8,7 +8,7 @@ use anyhow::{anyhow, bail, Context, Result}; use cargo_metadata::{camino, Package}; use serde::Deserialize; -use crate::{config::CargoArguments, BuildOutput, OutputType}; +use crate::{commands::CargoOptions, BuildOutput, OutputType}; /// Defines dependency (the rhs of the dependency `"ns:package" = { path = "..." }` pair) #[derive(Deserialize, Debug, Clone)] @@ -32,7 +32,7 @@ struct MidenMetadata { /// and collecting the paths to the resulting `.masp` package artifacts. pub fn process_miden_dependencies( package: &Package, - cargo_args: &CargoArguments, + cargo_opts: &CargoOptions, ) -> Result> { let mut dependency_packages_paths: Vec = Vec::new(); // Avoid redundant builds/checks @@ -137,7 +137,7 @@ pub fn process_miden_dependencies( dep_manifest_path.to_string_lossy().to_string(), ]; // Inherit release/debug profile from parent build - if cargo_args.release { + if cargo_opts.release { dep_build_args.push("--release".to_string()); } // Dependencies should always be built as libraries From 6a413e4eac5513aa313eaa7e53bd84dff92bd064 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 28 Nov 2025 18:14:36 +0200 Subject: [PATCH 24/70] refactor: `cargo miden build` returns error on invalid cargo package spec --- tools/cargo-miden/src/commands/build.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index 7925b1921..76c580dfd 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -44,7 +44,7 @@ impl BuildCommand { })?; // Extract cargo-specific options from parsed Compiler struct - let cargo_opts = CargoOptions::from_compiler(&compiler_opts); + let cargo_opts = CargoOptions::from_compiler(&compiler_opts)?; let metadata = load_metadata(cargo_opts.manifest_path.as_deref())?; @@ -171,25 +171,22 @@ pub struct CargoOptions { impl CargoOptions { /// Extract cargo-specific options from a Compiler struct. - fn from_compiler(compiler: &Compiler) -> Self { + fn from_compiler(compiler: &Compiler) -> Result { let packages = compiler .package .iter() - .filter_map(|s| match CargoPackageSpec::new(s.clone()) { - Ok(spec) => Some(spec), - Err(e) => { - log::warn!("ignoring invalid package spec '{s}': {e}"); - None - } + .map(|s| { + CargoPackageSpec::new(s.clone()) + .with_context(|| format!("invalid package spec '{s}'")) }) - .collect(); + .collect::>>()?; - Self { + Ok(Self { release: compiler.release, manifest_path: compiler.manifest_path.clone(), workspace: compiler.workspace, packages, - } + }) } } From e958571ff8537c0320f5a3cd1c5090966442c10d Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 28 Nov 2025 18:34:39 +0200 Subject: [PATCH 25/70] refactor: clean up unused code, improve error messages --- tools/cargo-miden/src/commands/build.rs | 4 +-- tools/cargo-miden/src/commands/mod.rs | 3 +- tools/cargo-miden/src/config.rs | 39 +------------------------ tools/cargo-miden/tests/build.rs | 4 +-- 4 files changed, 6 insertions(+), 44 deletions(-) diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index 76c580dfd..51e324a44 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -40,7 +40,7 @@ impl BuildCommand { // This gives us a structured representation of all options. let compiler_opts = Compiler::try_parse_from(&self.args).map_err(|e| { // Render the clap error with full formatting (colors, suggestions, etc.) - anyhow::anyhow!("{}", e.render()) + anyhow::anyhow!("failed to parse 'cargo miden build' arguments: {}", e.render()) })?; // Extract cargo-specific options from parsed Compiler struct @@ -310,7 +310,7 @@ fn run_cargo(wasi: &str, spawn_args: &[String]) -> Result> { Ok(outputs) } -pub fn spawn_cargo(mut cmd: Command, cargo: &Path) -> Result> { +fn spawn_cargo(mut cmd: Command, cargo: &Path) -> Result> { log::debug!("spawning command {cmd:?}"); let mut child = cmd diff --git a/tools/cargo-miden/src/commands/mod.rs b/tools/cargo-miden/src/commands/mod.rs index 3e8473b4f..7f8f4d7ef 100644 --- a/tools/cargo-miden/src/commands/mod.rs +++ b/tools/cargo-miden/src/commands/mod.rs @@ -2,6 +2,7 @@ pub mod build; pub mod example_project; pub mod new_project; -pub use build::{BuildCommand, CargoOptions}; +pub use build::BuildCommand; +pub(crate) use build::CargoOptions; pub use example_project::ExampleCommand; pub use new_project::NewCommand; diff --git a/tools/cargo-miden/src/config.rs b/tools/cargo-miden/src/config.rs index e84d968a2..b0206ef33 100644 --- a/tools/cargo-miden/src/config.rs +++ b/tools/cargo-miden/src/config.rs @@ -1,29 +1,9 @@ -//! Module for cargo-component configuration. -//! -//! This implements an argument parser because `clap` is not -//! designed for parsing unknown or unsupported arguments. -//! -//! See https://github.com/clap-rs/clap/issues/1404 for some -//! discussion around this issue. -//! -//! To properly "wrap" `cargo` commands, we need to be able to -//! detect certain arguments, but not error out if the arguments -//! are otherwise unknown as they will be passed to `cargo` directly. -//! -//! This will allow `cargo-component` to be used as a drop-in -//! replacement for `cargo` without having to be fully aware of -//! the many subcommands and options that `cargo` supports. -//! -//! What is detected here is the minimal subset of the arguments -//! that `cargo` supports which are necessary for `cargo-component` -//! to function. +//! Cargo package specification types for `cargo-miden`. use std::{fmt, str::FromStr}; use anyhow::{bail, Context, Result}; -use cargo_metadata::Metadata; use semver::Version; -use toml_edit::DocumentMut; /// Represents a cargo package specifier. /// @@ -61,23 +41,6 @@ impl CargoPackageSpec { }, }) } - - /// Loads Cargo.toml in the current directory, attempts to find the matching package from metadata. - #[allow(unused)] - pub fn find_current_package_spec(metadata: &Metadata) -> Option { - let current_manifest = std::fs::read_to_string("Cargo.toml").ok()?; - let document: DocumentMut = current_manifest.parse().ok()?; - let name = document["package"]["name"].as_str()?; - let version = metadata - .packages - .iter() - .find(|found| found.name == name) - .map(|found| found.version.clone()); - Some(CargoPackageSpec { - name: name.to_string(), - version, - }) - } } impl FromStr for CargoPackageSpec { diff --git a/tools/cargo-miden/tests/build.rs b/tools/cargo-miden/tests/build.rs index d4497abe2..afe9f172a 100644 --- a/tools/cargo-miden/tests/build.rs +++ b/tools/cargo-miden/tests/build.rs @@ -1,5 +1,3 @@ -#![allow(unused)] - use std::{env, fs}; use cargo_miden::{run, OutputType}; @@ -363,7 +361,7 @@ fn build_new_project_from_template(template: &str) -> Package { if expected_new_project_dir.exists() { fs::remove_dir_all(expected_new_project_dir).unwrap(); } - let output = run(new_project_args(project_name, "--account").into_iter(), OutputType::Masm) + let _ = run(new_project_args(project_name, "--account").into_iter(), OutputType::Masm) .expect("Failed to create new add-contract dependency project") .expect("'cargo miden new' should return Some(CommandOutput)"); } From 56225f098aa99f2620132a6b517c18ad126b8fad Mon Sep 17 00:00:00 2001 From: crStiv Date: Tue, 2 Dec 2025 14:37:31 +0100 Subject: [PATCH 26/70] Add tests for new project workspace integration Added tests to ensure new projects are correctly added to the Cargo workspace, including handling existing members and preventing duplicates. --- tools/cargo-miden/tests/workspace.rs | 200 +++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/tools/cargo-miden/tests/workspace.rs b/tools/cargo-miden/tests/workspace.rs index 681482131..951bf185e 100644 --- a/tools/cargo-miden/tests/workspace.rs +++ b/tools/cargo-miden/tests/workspace.rs @@ -20,6 +20,40 @@ repository = "https://example.com/test" fs::write(root.join("Cargo.toml"), ws_toml).expect("write workspace Cargo.toml"); } +/// Creates a minimal Cargo workspace at `root` without members array. +fn write_workspace_root_no_members(root: &Path) { + let ws_toml = r#"[workspace] +resolver = "2" + +[workspace.package] +version = "0.1.0" +edition = "2021" +authors = ["Miden Contributors"] +license = "MIT" +repository = "https://example.com/test" +"#; + fs::write(root.join("Cargo.toml"), ws_toml).expect("write workspace Cargo.toml"); +} + +/// Creates a minimal Cargo workspace at `root` with existing members. +fn write_workspace_root_with_members(root: &Path, members: &[&str]) { + let members_str = members.iter().map(|m| format!("\"{m}\"")).collect::>().join(", "); + let ws_toml = format!( + r#"[workspace] +resolver = "2" +members = [{members_str}] + +[workspace.package] +version = "0.1.0" +edition = "2021" +authors = ["Miden Contributors"] +license = "MIT" +repository = "https://example.com/test" +"# + ); + fs::write(root.join("Cargo.toml"), ws_toml).expect("write workspace Cargo.toml"); +} + fn new_project_args(project_name: &str, template: &str) -> Vec { let template = if let Ok(templates_path) = std::env::var("TEST_LOCAL_TEMPLATES_PATH") { &format!("--template-path={templates_path}/{}", template.trim_start_matches("--")) @@ -134,3 +168,169 @@ fn build_from_workspace_root_is_rejected() { env::set_current_dir(restore_dir).unwrap(); fs::remove_dir_all(ws_root).unwrap(); } + +#[test] +fn new_project_auto_adds_to_workspace() { + let _ = env_logger::Builder::from_env("MIDENC_TRACE") + .is_test(true) + .format_timestamp(None) + .try_init(); + env::set_var("TEST", "1"); + + // create temp workspace root + let restore_dir = env::current_dir().unwrap(); + let ws_root = env::temp_dir().join(format!( + "cargo_miden_ws_auto_add_test_{}", + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_millis() + )); + if ws_root.exists() { + fs::remove_dir_all(&ws_root).unwrap(); + } + fs::create_dir_all(&ws_root).unwrap(); + env::set_current_dir(&ws_root).unwrap(); + + // write workspace manifest without members + write_workspace_root_no_members(&ws_root); + + // create a new project inside the workspace + let project_name = "new_member"; + let output = run(new_project_args(project_name, "--account").into_iter(), OutputType::Masm) + .expect("cargo miden new failed") + .expect("expected NewCommandOutput"); + let project_path = match output { + cargo_miden::CommandOutput::NewCommandOutput { project_path } => project_path, + other => panic!("Expected NewCommandOutput, got {other:?}"), + }; + assert!(project_path.ends_with(project_name)); + + // verify that the project was added to workspace Cargo.toml + let workspace_toml_path = ws_root.join("Cargo.toml"); + let workspace_content = + fs::read_to_string(&workspace_toml_path).expect("Failed to read workspace Cargo.toml"); + assert!( + workspace_content.contains(&format!("\"{project_name}\"")), + "Workspace Cargo.toml should contain the new project in members array. \ + Content:\n{workspace_content}" + ); + assert!( + workspace_content.contains("members ="), + "Workspace Cargo.toml should have members array. Content:\n{workspace_content}" + ); + + // cleanup + env::set_current_dir(restore_dir).unwrap(); + fs::remove_dir_all(ws_root).unwrap(); +} + +#[test] +fn new_project_auto_adds_to_workspace_with_existing_members() { + let _ = env_logger::Builder::from_env("MIDENC_TRACE") + .is_test(true) + .format_timestamp(None) + .try_init(); + env::set_var("TEST", "1"); + + // create temp workspace root + let restore_dir = env::current_dir().unwrap(); + let ws_root = env::temp_dir().join(format!( + "cargo_miden_ws_auto_add_existing_test_{}", + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_millis() + )); + if ws_root.exists() { + fs::remove_dir_all(&ws_root).unwrap(); + } + fs::create_dir_all(&ws_root).unwrap(); + env::set_current_dir(&ws_root).unwrap(); + + // write workspace manifest with existing members + let existing_member = "existing_member"; + write_workspace_root_with_members(&ws_root, &[existing_member]); + + // create a new project inside the workspace + let project_name = "new_member"; + let output = run(new_project_args(project_name, "--account").into_iter(), OutputType::Masm) + .expect("cargo miden new failed") + .expect("expected NewCommandOutput"); + let project_path = match output { + cargo_miden::CommandOutput::NewCommandOutput { project_path } => project_path, + other => panic!("Expected NewCommandOutput, got {other:?}"), + }; + assert!(project_path.ends_with(project_name)); + + // verify that both the existing member and new project are in workspace Cargo.toml + let workspace_toml_path = ws_root.join("Cargo.toml"); + let workspace_content = + fs::read_to_string(&workspace_toml_path).expect("Failed to read workspace Cargo.toml"); + assert!( + workspace_content.contains(&format!("\"{existing_member}\"")), + "Workspace Cargo.toml should still contain existing member. Content:\n{workspace_content}" + ); + assert!( + workspace_content.contains(&format!("\"{project_name}\"")), + "Workspace Cargo.toml should contain the new project in members array. \ + Content:\n{workspace_content}" + ); + + // cleanup + env::set_current_dir(restore_dir).unwrap(); + fs::remove_dir_all(ws_root).unwrap(); +} + +#[test] +fn new_project_does_not_duplicate_existing_member() { + let _ = env_logger::Builder::from_env("MIDENC_TRACE") + .is_test(true) + .format_timestamp(None) + .try_init(); + env::set_var("TEST", "1"); + + // create temp workspace root + let restore_dir = env::current_dir().unwrap(); + let ws_root = env::temp_dir().join(format!( + "cargo_miden_ws_no_dup_test_{}", + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_millis() + )); + if ws_root.exists() { + fs::remove_dir_all(&ws_root).unwrap(); + } + fs::create_dir_all(&ws_root).unwrap(); + env::set_current_dir(&ws_root).unwrap(); + + // write workspace manifest with the project already as a member + let project_name = "existing_project"; + write_workspace_root_with_members(&ws_root, &[project_name]); + + // create the project (it's already in members) + let output = run(new_project_args(project_name, "--account").into_iter(), OutputType::Masm) + .expect("cargo miden new failed") + .expect("expected NewCommandOutput"); + let project_path = match output { + cargo_miden::CommandOutput::NewCommandOutput { project_path } => project_path, + other => panic!("Expected NewCommandOutput, got {other:?}"), + }; + assert!(project_path.ends_with(project_name)); + + // verify that the project appears only once in workspace Cargo.toml + let workspace_toml_path = ws_root.join("Cargo.toml"); + let workspace_content = + fs::read_to_string(&workspace_toml_path).expect("Failed to read workspace Cargo.toml"); + let member_count = workspace_content.matches(&format!("\"{project_name}\"")).count(); + assert_eq!( + member_count, 1, + "Project should appear exactly once in members array. Found {member_count} times. \ + Content:\n{workspace_content}" + ); + + // cleanup + env::set_current_dir(restore_dir).unwrap(); + fs::remove_dir_all(ws_root).unwrap(); +} From 57d355fb8ce66632fa102a8b500adbc1dc99c42b Mon Sep 17 00:00:00 2001 From: Djordje Todorovic Date: Fri, 14 Nov 2025 17:03:47 +0100 Subject: [PATCH 27/70] Fix source locations when trim-paths is being used - Add lit test for it: $ litcheck lit run --path bin tests/lit/source-location/ - Add HIR serialization in form of text --- Cargo.lock | 1 + Makefile.toml | 1 + frontend/wasm/src/config.rs | 8 ++- frontend/wasm/src/module/build_ir.rs | 1 + frontend/wasm/src/module/func_translator.rs | 55 +++++++++++++++++-- hir/src/ir/print.rs | 35 ++++++++++++ midenc-compile/Cargo.toml | 1 + midenc-compile/src/compiler.rs | 25 +++++++++ midenc-compile/src/stages/link.rs | 23 +++++++- midenc-session/src/emit.rs | 19 +++++++ midenc-session/src/options/mod.rs | 6 ++ tests/lit/source-location/lit.suite.toml | 5 ++ .../source-location/test-project/Cargo.lock | 7 +++ .../source-location/test-project/Cargo.toml | 17 ++++++ .../source-location/test-project/src/lib.rs | 20 +++++++ tests/lit/source-location/test.wat | 23 ++++++++ 16 files changed, 240 insertions(+), 7 deletions(-) create mode 100644 tests/lit/source-location/lit.suite.toml create mode 100644 tests/lit/source-location/test-project/Cargo.lock create mode 100644 tests/lit/source-location/test-project/Cargo.toml create mode 100644 tests/lit/source-location/test-project/src/lib.rs create mode 100644 tests/lit/source-location/test.wat diff --git a/Cargo.lock b/Cargo.lock index 62fa3da20..7fa5dd716 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2846,6 +2846,7 @@ dependencies = [ name = "midenc-compile" version = "0.5.1" dependencies = [ + "anyhow", "clap", "inventory", "log", diff --git a/Makefile.toml b/Makefile.toml index ca9ec38ca..5a1411acd 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -335,6 +335,7 @@ args = [ "${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", ] dependencies = ["litcheck"] diff --git a/frontend/wasm/src/config.rs b/frontend/wasm/src/config.rs index ea0078b75..6636e3bbf 100644 --- a/frontend/wasm/src/config.rs +++ b/frontend/wasm/src/config.rs @@ -1,4 +1,5 @@ -use alloc::borrow::Cow; +use alloc::{borrow::Cow, vec::Vec}; +use std::path::PathBuf; /// Configuration for the WASM translation. #[derive(Clone)] @@ -8,6 +9,9 @@ pub struct WasmTranslationConfig { /// binary, and an override name is not specified pub source_name: Cow<'static, str>, + /// Path prefixes to try when resolving relative paths from trimmed DWARF debug information. + pub trim_path_prefixes: Vec, + /// If specified, overrides the module/component name with the one specified pub override_name: Option>, @@ -26,6 +30,7 @@ impl core::fmt::Debug for WasmTranslationConfig { let world = if self.world.is_some() { "Some" } else { "None" }; f.debug_struct("WasmTranslationConfig") .field("source_name", &self.source_name) + .field("trim_path_prefixes", &self.trim_path_prefixes) .field("override_name", &self.override_name) .field("world", &world) .field("generate_native_debuginfo", &self.generate_native_debuginfo) @@ -38,6 +43,7 @@ impl Default for WasmTranslationConfig { fn default() -> Self { Self { source_name: Cow::Borrowed("noname"), + trim_path_prefixes: Vec::new(), override_name: None, world: None, generate_native_debuginfo: false, diff --git a/frontend/wasm/src/module/build_ir.rs b/frontend/wasm/src/module/build_ir.rs index 9f7f6c536..eb726ec68 100644 --- a/frontend/wasm/src/module/build_ir.rs +++ b/frontend/wasm/src/module/build_ir.rs @@ -145,6 +145,7 @@ pub fn build_ir_module( &addr2line, context.session(), &mut func_validator, + _config, )?; } Ok(()) diff --git a/frontend/wasm/src/module/func_translator.rs b/frontend/wasm/src/module/func_translator.rs index 8ec7e0f77..65d713613 100644 --- a/frontend/wasm/src/module/func_translator.rs +++ b/frontend/wasm/src/module/func_translator.rs @@ -69,6 +69,7 @@ impl FuncTranslator { addr2line: &addr2line::Context>, session: &Session, func_validator: &mut FuncValidator, + config: &crate::WasmTranslationConfig, ) -> WasmResult<()> { let context = func.borrow().as_operation().context_rc(); let mut op_builder = midenc_hir::OpBuilder::new(context) @@ -110,6 +111,7 @@ impl FuncTranslator { addr2line, session, func_validator, + config, )?; builder.finalize(); @@ -198,6 +200,7 @@ fn parse_function_body( addr2line: &addr2line::Context>, session: &Session, func_validator: &mut FuncValidator, + config: &crate::WasmTranslationConfig, ) -> WasmResult<()> { // The control stack is initialized with a single block representing the whole function. debug_assert_eq!(state.control_stack.len(), 1, "State not initialized"); @@ -216,15 +219,59 @@ fn parse_function_body( if let Some(loc) = addr2line.find_location(offset).into_diagnostic()? { if let Some(file) = loc.file { let path = std::path::Path::new(file); - let path = path.canonicalize().unwrap_or_else(|_| path.to_path_buf()); - if path.exists() { - let source_file = session.source_manager.load_file(&path).into_diagnostic()?; + + // Resolve relative paths to absolute paths + let resolved_path = if path.is_relative() { + // Strategy 1: Try trim_path_prefixes + if let Some(resolved) = config.trim_path_prefixes.iter().find_map(|prefix| { + let candidate = prefix.join(path); + if candidate.exists() { + // Canonicalize to get absolute path + candidate.canonicalize().ok() + } else { + None + } + }) { + Some(resolved) + } + // Strategy 2: Try session.options.current_dir as fallback + else { + let current_dir_candidate = session.options.current_dir.join(path); + if current_dir_candidate.exists() { + current_dir_candidate.canonicalize().ok() + } else { + None + } + } + } else { + // Path is absolute, but verify it exists and canonicalize it + if path.exists() { + path.canonicalize().ok() + } else { + None + } + }; + + if let Some(absolute_path) = resolved_path { + debug_assert!( + absolute_path.is_absolute(), + "resolved path should be absolute: {}", + absolute_path.display() + ); + log::debug!(target: "module-parser", + "resolved source path '{}' -> '{}'", + file, + absolute_path.display() + ); + let source_file = + 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(); } else { log::debug!(target: "module-parser", - "failed to locate span for instruction at offset {offset} in function {func_name}" + "failed to resolve source path '{file}' for instruction at offset \ + {offset} in function {func_name}" ); } } diff --git a/hir/src/ir/print.rs b/hir/src/ir/print.rs index ca3bfb3ea..d83bada89 100644 --- a/hir/src/ir/print.rs +++ b/hir/src/ir/print.rs @@ -13,6 +13,7 @@ use crate::{ pub struct OpPrintingFlags { pub print_entry_block_headers: bool, pub print_intrinsic_attributes: bool, + pub print_source_locations: bool, } impl Default for OpPrintingFlags { @@ -20,6 +21,7 @@ impl Default for OpPrintingFlags { Self { print_entry_block_headers: true, print_intrinsic_attributes: false, + print_source_locations: false, } } } @@ -175,6 +177,32 @@ pub fn render_regions(op: &Operation, flags: &OpPrintingFlags) -> crate::formatt + const_text(";") } +pub fn render_source_location(op: &Operation, context: &Context) -> crate::formatter::Document { + use crate::formatter::*; + + // Check if the span is valid (not default/empty) + if op.span.is_unknown() { + return Document::Empty; + } + + // Try to resolve the source location + let session = context.session(); + if let Ok(source_file) = session.source_manager.get(op.span.source_id()) { + let location = source_file.location(op.span); + // Format: #loc("filename":line:col) + let filename = source_file.uri().as_str(); + let loc_str = format!( + " #loc(\"{}\":{}:{})", + filename, + location.line.to_u32(), + location.column.to_u32() + ); + return text(loc_str); + } + + Document::Empty +} + struct OperationPrinter<'a> { op: &'a Operation, flags: &'a OpPrintingFlags, @@ -280,6 +308,13 @@ impl PrettyPrint for OperationPrinter<'_> { doc + const_text(" ") + attrs }; + // Add source location if requested + let doc = if self.flags.print_source_locations { + doc + render_source_location(self.op, self.context) + } else { + doc + }; + if self.op.has_regions() { doc + render_regions(self.op, self.flags) } else { 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 ccf197415..5e2427ea8 100644 --- a/midenc-compile/src/compiler.rs +++ b/midenc-compile/src/compiler.rs @@ -348,6 +348,29 @@ pub struct UnstableOptions { arg(long, default_value_t = false, help_heading = "Passes") )] pub print_ir_after_modified: bool, + /// Print source location information in HIR output + /// + /// When enabled, HIR output will include #loc() annotations showing the source file, + /// line, and column for each operation. + #[cfg_attr( + feature = "std", + arg( + long = "print-hir-source-locations", + default_value_t = false, + help_heading = "Printers" + ) + )] + pub print_hir_source_locations: bool, + /// Specify path prefixes to try when resolving relative paths from DWARF debug info + #[cfg_attr( + feature = "std", + arg( + long = "trim-path-prefix", + value_name = "PATH", + help_heading = "Debugging" + ) + )] + pub trim_path_prefixes: Vec, } impl CodegenOptions { @@ -516,6 +539,8 @@ 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_hir_source_locations = unstable.print_hir_source_locations; + options.trim_path_prefixes = unstable.trim_path_prefixes; // Establish --target-dir let target_dir = if self.target_dir.is_absolute() { diff --git a/midenc-compile/src/stages/link.rs b/midenc-compile/src/stages/link.rs index 2e5fcaac0..dc71a3481 100644 --- a/midenc-compile/src/stages/link.rs +++ b/midenc-compile/src/stages/link.rs @@ -1,4 +1,4 @@ -use alloc::{borrow::ToOwned, collections::BTreeMap, sync::Arc, vec::Vec}; +use alloc::{borrow::ToOwned, collections::BTreeMap, string::ToString, sync::Arc, vec::Vec}; use midenc_frontend_wasm::FrontendOutput; use midenc_hir::{interner::Symbol, BuilderExt, OpBuilder, SourceSpan}; @@ -6,7 +6,7 @@ use midenc_hir::{interner::Symbol, BuilderExt, OpBuilder, SourceSpan}; use midenc_session::Path; use midenc_session::{ diagnostics::{Severity, Spanned}, - InputType, ProjectType, + InputType, OutputMode, OutputType, ProjectType, }; use super::*; @@ -133,6 +133,7 @@ impl Stage for LinkStage { InputType::Stdin { name, input } => { let config = wasm::WasmTranslationConfig { source_name: name.file_stem().unwrap().to_owned().into(), + trim_path_prefixes: context.session().options.trim_path_prefixes.clone(), world: Some(world), ..Default::default() }; @@ -151,6 +152,22 @@ impl Stage for LinkStage { link_output.link_libraries_from(context.session())?; + // Emit HIR if requested + let session = context.session(); + if session.should_emit(OutputType::Hir) { + use midenc_hir::{Op, OpPrinter, OpPrintingFlags}; + let flags = OpPrintingFlags { + print_entry_block_headers: true, + print_intrinsic_attributes: false, + print_source_locations: session.options.print_hir_source_locations, + }; + let op = link_output.component.borrow(); + let hir_context = op.as_operation().context(); + let doc = op.as_operation().print(&flags, hir_context); + let hir_str = doc.to_string(); + session.emit(OutputMode::Text, &hir_str).into_diagnostic()?; + } + if context.session().parse_only() { log::debug!("stopping compiler early (parse-only=true)"); return Err(CompilerStopped.into()); @@ -181,8 +198,10 @@ fn parse_hir_from_wasm_file( let mut bytes = Vec::with_capacity(1024); file.read_to_end(&mut bytes).into_diagnostic()?; let file_name = path.file_stem().unwrap().to_str().unwrap().to_owned(); + let config = wasm::WasmTranslationConfig { source_name: file_name.into(), + trim_path_prefixes: context.session().options.trim_path_prefixes.clone(), world: Some(world), ..Default::default() }; diff --git a/midenc-session/src/emit.rs b/midenc-session/src/emit.rs index 324d66585..c13b23681 100644 --- a/midenc-session/src/emit.rs +++ b/midenc-session/src/emit.rs @@ -205,6 +205,25 @@ impl Emit for Arc { } } +impl Emit for alloc::string::String { + fn name(&self) -> Option { + None + } + + fn output_type(&self, _mode: OutputMode) -> OutputType { + OutputType::Hir + } + + fn write_to( + &self, + mut writer: W, + _mode: OutputMode, + _session: &Session, + ) -> anyhow::Result<()> { + writer.write_fmt(format_args!("{self}\n")) + } +} + impl Emit for miden_assembly::ast::Module { fn name(&self) -> Option { Some(Symbol::intern(self.path().to_string())) diff --git a/midenc-session/src/options/mod.rs b/midenc-session/src/options/mod.rs index 359e21ee7..f9baa2519 100644 --- a/midenc-session/src/options/mod.rs +++ b/midenc-session/src/options/mod.rs @@ -36,6 +36,10 @@ pub struct Options { pub diagnostics: DiagnosticsConfig, /// The current working directory of the compiler pub current_dir: PathBuf, + /// Path prefixes to try when resolving relative paths in DWARF debug info + pub trim_path_prefixes: Vec, + /// Print source location information in HIR output + pub print_hir_source_locations: bool, /// Only parse inputs pub parse_only: bool, /// Only perform semantic analysis on the input @@ -119,6 +123,8 @@ impl Options { color: Default::default(), diagnostics: Default::default(), current_dir, + trim_path_prefixes: vec![], + print_hir_source_locations: false, parse_only: false, analyze_only: false, link_only: false, diff --git a/tests/lit/source-location/lit.suite.toml b/tests/lit/source-location/lit.suite.toml new file mode 100644 index 000000000..ab10b18f3 --- /dev/null +++ b/tests/lit/source-location/lit.suite.toml @@ -0,0 +1,5 @@ +name = "source-location" +patterns = ["*.wat"] +working_dir = "../../../" + +[format.shtest] diff --git a/tests/lit/source-location/test-project/Cargo.lock b/tests/lit/source-location/test-project/Cargo.lock new file mode 100644 index 000000000..f7b90c683 --- /dev/null +++ b/tests/lit/source-location/test-project/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "source_location_test" +version = "0.1.0" diff --git a/tests/lit/source-location/test-project/Cargo.toml b/tests/lit/source-location/test-project/Cargo.toml new file mode 100644 index 000000000..9cfb3d179 --- /dev/null +++ b/tests/lit/source-location/test-project/Cargo.toml @@ -0,0 +1,17 @@ +cargo-features = ["trim-paths"] + +[package] +name = "source_location_test" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + +[profile.release] +debug = true +trim-paths = ["diagnostics", "object"] + +[profile.dev] +debug = true +trim-paths = ["diagnostics", "object"] diff --git a/tests/lit/source-location/test-project/src/lib.rs b/tests/lit/source-location/test-project/src/lib.rs new file mode 100644 index 000000000..4ee59256c --- /dev/null +++ b/tests/lit/source-location/test-project/src/lib.rs @@ -0,0 +1,20 @@ +#![no_std] +#![no_main] + +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! { + core::arch::wasm32::unreachable() +} + +#[no_mangle] +pub extern "C" fn test_assertion(x: u32) -> u32 { + assert!(x > 100, "x should be greater than 100"); + + x +} + +#[no_mangle] +#[inline(never)] +pub fn entrypoint(x: u32) -> u32 { + test_assertion(x) +} diff --git a/tests/lit/source-location/test.wat b/tests/lit/source-location/test.wat new file mode 100644 index 000000000..9193e1d87 --- /dev/null +++ b/tests/lit/source-location/test.wat @@ -0,0 +1,23 @@ +;; 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":{{.*}}) From f6f96a4ee363c620229fa6ba1234e15664b9caf4 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 3 Dec 2025 11:33:01 +0200 Subject: [PATCH 28/70] chore: clean up the node's data folder before bootstrapping, Use the data folder itself as a "node bootstrapped" marker instead of a explicit marker file file. --- .../src/local_node/process.rs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/integration-node/src/local_node/process.rs b/tests/integration-node/src/local_node/process.rs index ccf426993..43648bc35 100644 --- a/tests/integration-node/src/local_node/process.rs +++ b/tests/integration-node/src/local_node/process.rs @@ -1,7 +1,7 @@ //! Process management functionality for the shared node use std::{ - fs::{self, File}, + fs, net::TcpStream, process::{Command, Stdio}, thread, @@ -81,16 +81,20 @@ pub fn kill_process(pid: u32) -> Result<()> { pub async fn start_shared_node() -> Result { eprintln!("[SharedNode] Starting shared node process..."); - // Ensure data directory exists + // Bootstrap if needed (data directory empty or doesn't exist) let data_dir_path = data_dir(); - fs::create_dir_all(&data_dir_path).context("Failed to create data directory")?; - - // Bootstrap if needed - let marker_file = data_dir_path.join(".bootstrapped"); - if !marker_file.exists() { + 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")?; - // Create marker file - File::create(&marker_file).context("Failed to create bootstrap marker file")?; } // Start the node process From 2f82c0b429c42697cec1bee853c5e7e7b61f7b95 Mon Sep 17 00:00:00 2001 From: Toby Hutton Date: Thu, 11 Dec 2025 14:12:05 +1100 Subject: [PATCH 29/70] Change the memory representation of 64-bit, dual-limbed values to be little-endian. In memory the low (least significant) 32-bit limb is now loaded or stored from/to `addr` and the high 32-bit limb from/to `addr+1`. On the stack the limb order is still big-endian. --- codegen/masm/intrinsics/mem.masm | 27 ++-- codegen/masm/src/emit/mem.rs | 35 +++-- .../abi_transform_stdlib_blake3_hash.masm | 12 ++ tests/integration/expected/add_i128.masm | 4 + tests/integration/expected/add_u128.masm | 4 + .../examples/auth_component_no_auth.masm | 24 +++ .../auth_component_rpo_falcon512.masm | 42 ++++++ .../expected/examples/basic_wallet.masm | 18 +++ .../examples/basic_wallet_tx_script.masm | 18 +++ .../expected/examples/counter.masm | 30 ++++ tests/integration/expected/examples/p2id.masm | 9 ++ .../expected/examples/storage_example.masm | 36 +++++ tests/integration/expected/hash_elements.masm | 18 +++ tests/integration/expected/hash_words.masm | 18 +++ tests/integration/expected/mul_i128.masm | 7 + tests/integration/expected/mul_u128.masm | 7 + .../rust_sdk/component_macros_note.masm | 2 + .../rust_sdk/cross_ctx_account_word.masm | 3 + .../rust_sdk/cross_ctx_note_word.masm | 5 + ...nt_asset_build_fungible_asset_binding.masm | 24 +++ ...sset_build_non_fungible_asset_binding.masm | 30 ++++ ...dk_account_compute_commitment_binding.masm | 24 +++ ...ount_compute_delta_commitment_binding.masm | 24 +++ ...nt_compute_storage_commitment_binding.masm | 24 +++ .../rust_sdk_account_faucet_burn_binding.masm | 30 ++++ ..._faucet_create_fungible_asset_binding.masm | 24 +++ ...cet_create_non_fungible_asset_binding.masm | 30 ++++ ..._is_non_fungible_asset_issued_binding.masm | 6 + .../rust_sdk_account_faucet_mint_binding.masm | 30 ++++ ...k_account_get_code_commitment_binding.masm | 24 +++ ...et_initial_storage_commitment_binding.masm | 24 +++ ...ccount_get_initial_vault_root_binding.masm | 24 +++ ...dk_account_get_procedure_root_binding.masm | 24 +++ ...st_sdk_account_get_vault_root_binding.masm | 24 +++ ...ccount_has_non_fungible_asset_binding.masm | 6 + ...ount_storage_get_initial_item_binding.masm | 24 +++ ..._storage_get_initial_map_item_binding.masm | 24 +++ ...count_tx_get_block_commitment_binding.masm | 18 +++ ...tx_get_input_notes_commitment_binding.masm | 18 +++ ...x_get_output_notes_commitment_binding.masm | 18 +++ ...ust_sdk_input_note_get_assets_binding.masm | 6 + ...dk_input_note_get_assets_info_binding.masm | 18 +++ ...dk_input_note_get_inputs_info_binding.masm | 18 +++ ...t_sdk_input_note_get_metadata_binding.masm | 24 +++ ..._sdk_input_note_get_recipient_binding.masm | 34 +++++ ...dk_input_note_get_script_root_binding.masm | 24 +++ ...ust_sdk_input_note_get_sender_binding.masm | 6 + ..._input_note_get_serial_number_binding.masm | 24 +++ ...ust_sdk_output_note_add_asset_binding.masm | 6 + .../rust_sdk_output_note_create_binding.masm | 6 + ...st_sdk_output_note_get_assets_binding.masm | 6 + ...k_output_note_get_assets_info_binding.masm | 18 +++ ..._sdk_output_note_get_metadata_binding.masm | 24 +++ ...sdk_output_note_get_recipient_binding.masm | 24 +++ .../rust_sdk_swapp_note_bindings.masm | 27 ++++ .../expected/rust_sdk_stdlib_sha256_hash.masm | 36 +++++ .../expected/rust_sdk_stdlib_smt_get.masm | 24 +++ .../expected/rust_sdk_stdlib_smt_set.masm | 24 +++ tests/integration/expected/sub_i128.masm | 4 + tests/integration/expected/sub_u128.masm | 4 + .../integration/src/codegen/intrinsics/mem.rs | 138 ++++++++++++++---- .../src/rust_masm_tests/instructions.rs | 19 ++- 62 files changed, 1241 insertions(+), 66 deletions(-) diff --git a/codegen/masm/intrinsics/mem.masm b/codegen/masm/intrinsics/mem.masm index 24d2300c7..5aaa3d1d4 100644 --- a/codegen/masm/intrinsics/mem.masm +++ b/codegen/masm/intrinsics/mem.masm @@ -288,7 +288,7 @@ export.realign_dw # [chunk_hi, chunk_mid, chunk_lo, offset] swap.1 # [x_hi, x_lo] end -# Shift a double-word (64-bit, in two 32-bit chunks) value by the given offset. +# 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] @@ -308,7 +308,7 @@ export.offset_dw # [value_hi, value_lo, offset] u32shr # [ chunk_lo, chunk_mid, chunk_hi] end -# Load a machine double-word (64-bit value, in two 32-bit chunks) to the operand stack +# Load two 32-bit words to the operand stack export.load_dw # [addr, offset] # check for alignment and offset validity dup.1 eq.0 # [offset == 0, addr, offset] @@ -326,16 +326,17 @@ export.load_dw # [addr, offset] else # unaligned; an unaligned double-word spans three elements # - # convert offset from bytes to bits - swap.1 push.8 u32wrapping_mul swap.1 # [addr, bit_offset] - - # load the three elements containing the double-word on the stack - dup.0 push.2 u32overflowing_add assertz mem_load # [e2, addr, bit_offset] - dup.1 push.1 add mem_load # [e1, e2, addr, bit_offset] - movup.2 mem_load # [e0, e1, e2, bit_offset] - - # re-align it, and we're done + # convert offset from bytes to bitcount from RHS of triplet (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 + # NOTE: realign_dw expects the hi, mid, lo word inputs and returns hi, lo (i.e., everything + # is 64-bit big-endian limb oriented), so we must swap the output to be in the correct order + dup.0 mem_load # [e0, addr, bit_offset] + dup.1 push.1 u32overflowing_add assertz mem_load # [e1, e0, addr, bit_offset] + movup.2 push.2 u32overflowing_add assertz mem_load # [e2, e1, e0, bit_offset] exec.realign_dw + swap.1 end end @@ -434,7 +435,7 @@ export.store_sw # [addr, offset, value] end end -# Store a 64-bit value, i.e. two 32-bit machine words from the given native pointer tuple. +# Store two 32-bit words to 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. @@ -536,7 +537,7 @@ end # Write `count` copies of `value` to memory, starting at `dst`. # # * `dst` is expected to be an address in byte-addressable space, _not_ an element address. -# * `value` must be a 64-bit value or smaller +# * `value` must be a two 32-bit words. export.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] diff --git a/codegen/masm/src/emit/mem.rs b/codegen/masm/src/emit/mem.rs index 667e3349d..89925384d 100644 --- a/codegen/masm/src/emit/mem.rs +++ b/codegen/masm/src/emit/mem.rs @@ -62,7 +62,7 @@ impl OpEmitter<'_> { ); match &ty { Type::I128 => self.load_quad_word(None, span), - Type::I64 | Type::U64 => self.load_double_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), ty @ (Type::I16 | Type::U16 | Type::U8 | Type::I8 | Type::I1) => { @@ -87,7 +87,7 @@ impl OpEmitter<'_> { let ptr = NativePtr::from_ptr(addr); match &ty { Type::I128 => self.load_quad_word(Some(ptr), span), - Type::I64 | Type::U64 => self.load_double_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::I16 | Type::U16 | Type::U8 | Type::I8 | Type::I1 => { @@ -170,13 +170,17 @@ impl OpEmitter<'_> { } } - /// Load a pair of machine words (32-bit elements) to the operand stack - fn load_double_word(&mut self, ptr: Option, span: SourceSpan) { + /// Load a 64-bit word from the given address. + fn load_double_word_int(&mut self, ptr: Option, span: SourceSpan) { if let Some(imm) = ptr { - return self.load_double_word_imm(imm, span); + 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 + // them to make a big-endian-limbed stack value. + self.emit(masm::Instruction::Swap1, span); } /// Load a sub-word value (u8, u16, etc.) from memory @@ -538,7 +542,7 @@ impl OpEmitter<'_> { ); match value_ty { Type::I128 => self.store_quad_word(None, span), - Type::I64 | Type::U64 => self.store_double_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), ref ty if ty.size_in_bytes() <= 4 => self.store_small(ty, None, span), @@ -566,7 +570,7 @@ impl OpEmitter<'_> { let ptr = NativePtr::from_ptr(addr); match value_ty { Type::I128 => self.store_quad_word(Some(ptr), span), - Type::I64 | Type::U64 => self.store_double_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), ref ty if ty.size_in_bytes() <= 4 => self.store_small(ty, Some(ptr), span), @@ -853,13 +857,18 @@ impl OpEmitter<'_> { } } - /// Store a pair of machine words (32-bit elements) to the operand stack - fn store_double_word(&mut self, ptr: Option, span: SourceSpan) { + /// Store a 64-bit word to the operand stack + 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 { - return self.store_double_word_imm(imm, span); + self.store_double_word_imm(imm, span); + } else { + self.raw_exec("intrinsics::mem::store_dw", span); } - - self.raw_exec("intrinsics::mem::store_dw", span); } fn store_double_word_imm(&mut self, ptr: NativePtr, span: SourceSpan) { diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm index f8e5f095a..e1a636be4 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm @@ -156,11 +156,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.5 u32wrapping_add u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -183,11 +186,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.5 u32wrapping_add u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -210,11 +216,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.5 u32wrapping_add u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -233,9 +242,12 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.3 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/add_i128.masm b/tests/integration/expected/add_i128.masm index 1206791be..900face52 100644 --- a/tests/integration/expected/add_i128.masm +++ b/tests/integration/expected/add_i128.masm @@ -44,6 +44,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -58,6 +60,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/add_u128.masm b/tests/integration/expected/add_u128.masm index 7cceaba19..74f6bc9fa 100644 --- a/tests/integration/expected/add_u128.masm +++ b/tests/integration/expected/add_u128.masm @@ -44,6 +44,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -58,6 +60,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/examples/auth_component_no_auth.masm b/tests/integration/expected/examples/auth_component_no_auth.masm index d3a9e54c8..f99bec676 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.masm +++ b/tests/integration/expected/examples/auth_component_no_auth.masm @@ -109,6 +109,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.56 dup.3 add @@ -121,6 +122,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -143,6 +146,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.48 dup.3 add @@ -155,6 +159,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -194,6 +200,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.56 dup.3 add @@ -206,6 +213,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -228,6 +237,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.48 dup.3 add @@ -240,6 +250,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -599,6 +611,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -611,6 +624,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -630,6 +645,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -639,6 +655,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -786,6 +804,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -798,6 +817,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -816,6 +837,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -825,6 +847,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm index a10c5c551..d78fbeb1f 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm @@ -119,6 +119,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.104 dup.5 add @@ -131,6 +132,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -153,6 +156,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.96 dup.5 add @@ -165,6 +169,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -330,6 +336,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.104 dup.3 add @@ -342,6 +349,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -364,6 +373,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.96 dup.3 add @@ -376,6 +386,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -687,6 +699,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.104 dup.3 add @@ -699,6 +712,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -721,6 +736,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.96 dup.3 add @@ -733,6 +749,8 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -989,6 +1007,7 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -1001,6 +1020,8 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1020,6 +1041,7 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -1032,6 +1054,8 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1105,6 +1129,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -1117,6 +1142,8 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1136,6 +1163,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -1148,6 +1176,8 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1393,6 +1423,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -1405,6 +1436,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1424,6 +1457,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -1433,6 +1467,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1580,6 +1616,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -1592,6 +1629,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1610,6 +1649,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -1619,6 +1659,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/examples/basic_wallet.masm b/tests/integration/expected/examples/basic_wallet.masm index d7c0b9e5b..e216fd157 100644 --- a/tests/integration/expected/examples/basic_wallet.masm +++ b/tests/integration/expected/examples/basic_wallet.masm @@ -589,6 +589,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -601,6 +602,8 @@ proc miden_base_sys::bindings::native_account::remove_asset( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -620,6 +623,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -632,6 +636,8 @@ proc miden_base_sys::bindings::native_account::remove_asset( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -769,6 +775,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -781,6 +788,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -800,6 +809,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -809,6 +819,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -956,6 +968,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -968,6 +981,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -986,6 +1001,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -995,6 +1011,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.masm b/tests/integration/expected/examples/basic_wallet_tx_script.masm index e21edb60e..3a78841d9 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -750,6 +750,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 movup.3 u32wrapping_add @@ -766,6 +767,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 push.32 dup.10 @@ -779,6 +781,8 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -796,6 +800,8 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -888,6 +894,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 movup.3 u32wrapping_add @@ -904,6 +911,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 push.48 dup.8 @@ -917,6 +925,8 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -934,6 +944,8 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1453,6 +1465,7 @@ proc ::with_capacity(i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -1022,6 +1023,8 @@ proc alloc::vec::Vec::with_capacity(i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1270,6 +1273,7 @@ proc miden_base_sys::bindings::active_account::get_id( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.3 push.8 dup.1 @@ -1279,6 +1283,8 @@ proc miden_base_sys::bindings::active_account::get_id( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1526,6 +1532,7 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.3 push.4 dup.1 @@ -1535,6 +1542,8 @@ proc miden_base_sys::bindings::active_note::get_assets( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/examples/storage_example.masm b/tests/integration/expected/examples/storage_example.masm index 53f76f656..96673bd0a 100644 --- a/tests/integration/expected/examples/storage_example.masm +++ b/tests/integration/expected/examples/storage_example.masm @@ -126,6 +126,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.56 dup.3 add @@ -138,6 +139,8 @@ 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 @@ -157,6 +160,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.48 dup.3 add @@ -169,6 +173,8 @@ 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 @@ -447,6 +453,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.88 dup.3 add @@ -459,6 +466,8 @@ 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 @@ -481,6 +490,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.80 dup.3 add @@ -493,6 +503,8 @@ 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 @@ -514,6 +526,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.104 dup.3 add @@ -526,6 +539,8 @@ 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 @@ -548,6 +563,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.96 dup.3 add @@ -560,6 +576,8 @@ 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 @@ -671,6 +689,7 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -683,6 +702,8 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -705,6 +726,7 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -717,6 +739,8 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -875,6 +899,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -887,6 +912,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -906,6 +933,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -915,6 +943,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1062,6 +1092,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -1074,6 +1105,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1092,6 +1125,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -1101,6 +1135,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/hash_elements.masm b/tests/integration/expected/hash_elements.masm index a29386b20..d4c26eadd 100644 --- a/tests/integration/expected/hash_elements.masm +++ b/tests/integration/expected/hash_elements.masm @@ -140,6 +140,7 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -152,6 +153,8 @@ pub proc entrypoint(i32) -> felt assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -174,6 +177,7 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -186,6 +190,8 @@ pub proc entrypoint(i32) -> felt assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -275,6 +281,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -287,6 +294,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -306,6 +315,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -315,6 +325,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -462,6 +474,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -474,6 +487,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -492,6 +507,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -501,6 +517,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/hash_words.masm b/tests/integration/expected/hash_words.masm index 5e2286524..4ded1fe80 100644 --- a/tests/integration/expected/hash_words.masm +++ b/tests/integration/expected/hash_words.masm @@ -122,6 +122,7 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -134,6 +135,8 @@ pub proc entrypoint(i32) -> felt assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -156,6 +159,7 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -168,6 +172,8 @@ pub proc entrypoint(i32) -> felt assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -256,6 +262,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -268,6 +275,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -287,6 +296,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -296,6 +306,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -443,6 +455,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -455,6 +468,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -473,6 +488,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -482,6 +498,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/mul_i128.masm b/tests/integration/expected/mul_i128.masm index 986c12f21..e88022a8f 100644 --- a/tests/integration/expected/mul_i128.masm +++ b/tests/integration/expected/mul_i128.masm @@ -31,6 +31,8 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) locaddr.0 push.0 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -55,6 +57,8 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -87,6 +91,7 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.8 movup.8 trace.240 @@ -109,6 +114,8 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/mul_u128.masm b/tests/integration/expected/mul_u128.masm index 5715251be..4cc632bb2 100644 --- a/tests/integration/expected/mul_u128.masm +++ b/tests/integration/expected/mul_u128.masm @@ -31,6 +31,8 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) locaddr.0 push.0 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -55,6 +57,8 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -87,6 +91,7 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.8 movup.8 trace.240 @@ -109,6 +114,8 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/rust_sdk/component_macros_note.masm b/tests/integration/expected/rust_sdk/component_macros_note.masm index 47f39c643..48ea894ea 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.masm +++ b/tests/integration/expected/rust_sdk/component_macros_note.masm @@ -189,6 +189,8 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 0d1ac4b4f..4cffebed0 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm @@ -252,6 +252,7 @@ pub proc process-mixed( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.0 push.8 dup.4 @@ -1159,6 +1160,8 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 4fb5b0261..0010b5ac0 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm @@ -297,6 +297,8 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ u32wrapping_add u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -844,6 +846,8 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1083,6 +1087,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.0 push.4294967295 push.4294967295 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 50fefd5a6..f19661468 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 @@ -188,6 +188,7 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -200,6 +201,8 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -219,6 +222,7 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -228,6 +232,8 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -377,6 +383,7 @@ proc miden_base_sys::bindings::asset::build_fungible_asset( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -389,6 +396,8 @@ proc miden_base_sys::bindings::asset::build_fungible_asset( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -408,6 +417,7 @@ proc miden_base_sys::bindings::asset::build_fungible_asset( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -420,6 +430,8 @@ proc miden_base_sys::bindings::asset::build_fungible_asset( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -478,6 +490,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -490,6 +503,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -509,6 +524,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -518,6 +534,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -665,6 +683,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -677,6 +696,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -695,6 +716,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -704,6 +726,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 de2fc395d..e56aab9d3 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 @@ -265,6 +265,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -277,6 +278,8 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -299,6 +302,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.8 dup.1 @@ -308,6 +312,8 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -354,6 +360,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -366,6 +373,8 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -388,6 +397,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -397,6 +407,8 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -614,6 +626,7 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.4 add @@ -626,6 +639,8 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -645,6 +660,7 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.4 add @@ -657,6 +673,8 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -715,6 +733,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -727,6 +746,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -746,6 +767,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -755,6 +777,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -902,6 +926,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -914,6 +939,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -932,6 +959,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -941,6 +969,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 9648e63db..648e1c2cf 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 @@ -156,6 +156,7 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -168,6 +169,8 @@ 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 @@ -190,6 +193,7 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -202,6 +206,8 @@ 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 @@ -243,6 +249,7 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -255,6 +262,8 @@ 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 @@ -274,6 +283,7 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -283,6 +293,8 @@ 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 @@ -407,6 +419,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -419,6 +432,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -438,6 +453,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -447,6 +463,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -594,6 +612,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -606,6 +625,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -624,6 +645,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -633,6 +655,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 6d57357c6..c37e25772 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 @@ -156,6 +156,7 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -168,6 +169,8 @@ 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 @@ -190,6 +193,7 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -202,6 +206,8 @@ 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 @@ -243,6 +249,7 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -255,6 +262,8 @@ 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 @@ -274,6 +283,7 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -283,6 +293,8 @@ 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 @@ -407,6 +419,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -419,6 +432,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -438,6 +453,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -447,6 +463,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -594,6 +612,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -606,6 +625,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -624,6 +645,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -633,6 +655,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 4f2070eed..789480bc2 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 @@ -156,6 +156,7 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -168,6 +169,8 @@ 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 @@ -190,6 +193,7 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -202,6 +206,8 @@ 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 @@ -243,6 +249,7 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -255,6 +262,8 @@ 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 @@ -274,6 +283,7 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -283,6 +293,8 @@ 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 @@ -407,6 +419,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -419,6 +432,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -438,6 +453,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -447,6 +463,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -594,6 +612,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -606,6 +625,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -624,6 +645,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -633,6 +655,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 fe64d56b3..c3c4d5650 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 @@ -257,6 +257,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -269,6 +270,8 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -291,6 +294,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -300,6 +304,8 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -506,6 +512,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -518,6 +525,8 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -537,6 +546,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -549,6 +559,8 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -597,6 +609,7 @@ proc ::with_capacity(i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -604,6 +605,8 @@ proc alloc::vec::Vec::with_capacity(i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -897,6 +900,7 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.3 push.4 dup.1 @@ -906,6 +910,8 @@ proc miden_base_sys::bindings::input_note::get_assets( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 6cd4b5bdf..71d197d8d 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 @@ -244,6 +244,7 @@ proc miden_base_sys::bindings::input_note::get_assets_info( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -256,6 +257,8 @@ proc miden_base_sys::bindings::input_note::get_assets_info( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -275,6 +278,7 @@ proc miden_base_sys::bindings::input_note::get_assets_info( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -287,6 +291,8 @@ proc miden_base_sys::bindings::input_note::get_assets_info( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -379,6 +385,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -391,6 +398,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -410,6 +419,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -419,6 +429,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -566,6 +578,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -578,6 +591,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -596,6 +611,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -605,6 +621,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 8369fe464..26efc0b53 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 @@ -244,6 +244,7 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -256,6 +257,8 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -275,6 +278,7 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -287,6 +291,8 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -379,6 +385,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -391,6 +398,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -410,6 +419,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -419,6 +429,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -566,6 +578,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -578,6 +591,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -596,6 +611,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -605,6 +621,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 21e460f93..4503c561e 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 @@ -170,6 +170,7 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -182,6 +183,8 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -201,6 +204,7 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -210,6 +214,8 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -351,6 +357,7 @@ proc miden_base_sys::bindings::input_note::get_metadata( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -363,6 +370,8 @@ proc miden_base_sys::bindings::input_note::get_metadata( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -382,6 +391,7 @@ proc miden_base_sys::bindings::input_note::get_metadata( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -394,6 +404,8 @@ proc miden_base_sys::bindings::input_note::get_metadata( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -452,6 +464,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -464,6 +477,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -483,6 +498,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -492,6 +508,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -639,6 +657,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -651,6 +670,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -669,6 +690,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -678,6 +700,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 9d5bed474..617cfb6ef 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 @@ -173,6 +173,7 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -185,6 +186,8 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -204,6 +207,7 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -213,6 +217,8 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -354,6 +360,7 @@ proc miden_base_sys::bindings::input_note::get_recipient( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -366,6 +373,8 @@ proc miden_base_sys::bindings::input_note::get_recipient( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -385,6 +394,7 @@ proc miden_base_sys::bindings::input_note::get_recipient( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -397,6 +407,8 @@ proc miden_base_sys::bindings::input_note::get_recipient( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -430,6 +442,7 @@ proc miden_base_sys::bindings::input_note::get_recipient( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -445,6 +458,8 @@ proc miden_base_sys::bindings::input_note::get_recipient( movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -467,6 +482,7 @@ proc miden_base_sys::bindings::input_note::get_recipient( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.5 add @@ -482,6 +498,8 @@ proc miden_base_sys::bindings::input_note::get_recipient( movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -501,6 +519,8 @@ proc miden_base_sys::bindings::input_note::get_recipient( movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -515,6 +535,8 @@ proc miden_base_sys::bindings::input_note::get_recipient( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -564,6 +586,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -576,6 +599,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -595,6 +620,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -604,6 +630,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -751,6 +779,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -763,6 +792,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -781,6 +812,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -790,6 +822,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 d74131f3a..bc29094d2 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 @@ -170,6 +170,7 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -182,6 +183,8 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -201,6 +204,7 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -210,6 +214,8 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -351,6 +357,7 @@ proc miden_base_sys::bindings::input_note::get_script_root( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -363,6 +370,8 @@ proc miden_base_sys::bindings::input_note::get_script_root( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -382,6 +391,7 @@ proc miden_base_sys::bindings::input_note::get_script_root( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -394,6 +404,8 @@ proc miden_base_sys::bindings::input_note::get_script_root( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -452,6 +464,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -464,6 +477,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -483,6 +498,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -492,6 +508,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -639,6 +657,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -651,6 +670,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -669,6 +690,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -678,6 +700,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 34fbc940c..027fbcb12 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 @@ -145,6 +145,7 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -154,6 +155,8 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -297,6 +300,7 @@ proc miden_base_sys::bindings::input_note::get_sender( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.3 push.8 dup.1 @@ -306,6 +310,8 @@ proc miden_base_sys::bindings::input_note::get_sender( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 d645c6580..8c378634a 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 @@ -170,6 +170,7 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -182,6 +183,8 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -201,6 +204,7 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -210,6 +214,8 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -351,6 +357,7 @@ proc miden_base_sys::bindings::input_note::get_serial_number( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -363,6 +370,8 @@ proc miden_base_sys::bindings::input_note::get_serial_number( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -382,6 +391,7 @@ proc miden_base_sys::bindings::input_note::get_serial_number( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -394,6 +404,8 @@ proc miden_base_sys::bindings::input_note::get_serial_number( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -452,6 +464,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -464,6 +477,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -483,6 +498,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -492,6 +508,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -639,6 +657,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -651,6 +670,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -669,6 +690,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -678,6 +700,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 6eaf80472..4557b265a 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 @@ -371,6 +371,7 @@ proc ::with_capacity(i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -604,6 +605,8 @@ proc alloc::vec::Vec::with_capacity(i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -897,6 +900,7 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.3 push.4 dup.1 @@ -906,6 +910,8 @@ proc miden_base_sys::bindings::output_note::get_assets( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 00f9ed785..d5ff6e4b1 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 @@ -244,6 +244,7 @@ proc miden_base_sys::bindings::output_note::get_assets_info( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -256,6 +257,8 @@ 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 @@ -275,6 +278,7 @@ proc miden_base_sys::bindings::output_note::get_assets_info( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -287,6 +291,8 @@ 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 @@ -379,6 +385,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -391,6 +398,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -410,6 +419,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -419,6 +429,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -566,6 +578,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -578,6 +591,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -596,6 +611,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -605,6 +621,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 b532918db..da7acb964 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 @@ -170,6 +170,7 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -182,6 +183,8 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -201,6 +204,7 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -210,6 +214,8 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -351,6 +357,7 @@ proc miden_base_sys::bindings::output_note::get_metadata( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -363,6 +370,8 @@ proc miden_base_sys::bindings::output_note::get_metadata( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -382,6 +391,7 @@ proc miden_base_sys::bindings::output_note::get_metadata( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -394,6 +404,8 @@ proc miden_base_sys::bindings::output_note::get_metadata( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -452,6 +464,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -464,6 +477,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -483,6 +498,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -492,6 +508,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -639,6 +657,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -651,6 +670,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -669,6 +690,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -678,6 +700,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 af905fd0d..85cc62544 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 @@ -173,6 +173,7 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -185,6 +186,8 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -204,6 +207,7 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -213,6 +217,8 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -354,6 +360,7 @@ proc miden_base_sys::bindings::output_note::get_recipient( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -366,6 +373,8 @@ proc miden_base_sys::bindings::output_note::get_recipient( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -385,6 +394,7 @@ proc miden_base_sys::bindings::output_note::get_recipient( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -397,6 +407,8 @@ proc miden_base_sys::bindings::output_note::get_recipient( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -455,6 +467,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -467,6 +480,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -486,6 +501,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -495,6 +511,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -642,6 +660,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -654,6 +673,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -672,6 +693,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -681,6 +703,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw 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 be5ca8d81..19c56a9ca 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 @@ -598,6 +598,7 @@ proc miden_base_sys::bindings::active_note::get_sender( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.3 push.8 dup.1 @@ -607,6 +608,8 @@ proc miden_base_sys::bindings::active_note::get_sender( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -671,6 +674,7 @@ proc miden_base_sys::bindings::active_note::get_script_root( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -683,6 +687,8 @@ proc miden_base_sys::bindings::active_note::get_script_root( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -702,6 +708,7 @@ proc miden_base_sys::bindings::active_note::get_script_root( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -714,6 +721,8 @@ proc miden_base_sys::bindings::active_note::get_script_root( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -787,6 +796,7 @@ proc miden_base_sys::bindings::active_note::get_serial_number( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.3 add @@ -799,6 +809,8 @@ proc miden_base_sys::bindings::active_note::get_serial_number( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -818,6 +830,7 @@ proc miden_base_sys::bindings::active_note::get_serial_number( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.3 add @@ -830,6 +843,8 @@ proc miden_base_sys::bindings::active_note::get_serial_number( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -888,6 +903,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -900,6 +916,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -919,6 +937,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -928,6 +947,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1075,6 +1096,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -1087,6 +1109,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -1105,6 +1129,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -1114,6 +1139,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm index 34c36852e..217b59310 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm @@ -185,6 +185,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 push.32 dup.4 @@ -198,6 +199,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -213,6 +216,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 push.32 dup.4 @@ -226,6 +230,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -241,6 +247,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 push.32 dup.4 @@ -254,6 +261,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -267,6 +276,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -279,6 +289,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -526,6 +538,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.56 dup.3 add @@ -538,6 +551,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -560,6 +575,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.48 dup.3 add @@ -572,6 +588,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -594,6 +612,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.40 dup.3 add @@ -606,6 +625,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -625,6 +646,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.32 dup.3 add @@ -637,6 +659,8 @@ pub proc entrypoint(i32, i32) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -729,9 +753,12 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.3 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -754,11 +781,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.24 dup.4 u32wrapping_add u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -781,11 +811,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.16 dup.4 u32wrapping_add u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -808,11 +841,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 movup.3 u32wrapping_add u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm index 85534d6d6..343eeadaa 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm @@ -345,6 +345,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.104 dup.3 add @@ -357,6 +358,8 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -379,6 +382,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.96 dup.3 add @@ -391,6 +395,8 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -413,6 +419,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.120 dup.3 add @@ -425,6 +432,8 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -447,6 +456,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.112 dup.3 add @@ -459,6 +469,8 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -682,6 +694,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -694,6 +707,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -713,6 +728,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -722,6 +738,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -869,6 +887,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -881,6 +900,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -899,6 +920,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -908,6 +930,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm index 5da6cea82..40002ae17 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm @@ -284,6 +284,7 @@ pub proc entrypoint( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.72 dup.3 add @@ -296,6 +297,8 @@ pub proc entrypoint( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -318,6 +321,7 @@ pub proc entrypoint( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.64 dup.3 add @@ -330,6 +334,8 @@ pub proc entrypoint( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -352,6 +358,7 @@ pub proc entrypoint( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.88 dup.3 add @@ -364,6 +371,8 @@ pub proc entrypoint( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -386,6 +395,7 @@ pub proc entrypoint( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.80 dup.3 add @@ -398,6 +408,8 @@ pub proc entrypoint( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -713,6 +725,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.3 add @@ -725,6 +738,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -744,6 +759,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 dup.2 push.4 dup.1 @@ -753,6 +769,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -900,6 +918,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 push.8 dup.4 add @@ -912,6 +931,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -930,6 +951,7 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 push.8 dup.1 @@ -939,6 +961,8 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/sub_i128.masm b/tests/integration/expected/sub_i128.masm index f1817ffbe..026ca4557 100644 --- a/tests/integration/expected/sub_i128.masm +++ b/tests/integration/expected/sub_i128.masm @@ -49,6 +49,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -63,6 +65,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/expected/sub_u128.masm b/tests/integration/expected/sub_u128.masm index fa43082e1..7ec20ec87 100644 --- a/tests/integration/expected/sub_u128.masm +++ b/tests/integration/expected/sub_u128.masm @@ -49,6 +49,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw @@ -63,6 +65,8 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop exec.::intrinsics::mem::store_dw diff --git a/tests/integration/src/codegen/intrinsics/mem.rs b/tests/integration/src/codegen/intrinsics/mem.rs index 1442e2edd..4778daa31 100644 --- a/tests/integration/src/codegen/intrinsics/mem.rs +++ b/tests/integration/src/codegen/intrinsics/mem.rs @@ -70,14 +70,14 @@ fn load_sw() { Ok(()) })?; - prop_assert_eq!(output, value); + prop_assert_eq!(output, value, "expected 0x{:x}; found 0x{:x}", value, output,); Ok(()) }); match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {value:?}"); + Err(TestError::Fail(reason, value)) => { + panic!("FAILURE: {}\nMinimal failing case: {value:?}", reason.message()); } Ok(_) => (), _ => panic!("Unexpected test result: {res:?}"), @@ -111,28 +111,35 @@ fn load_dw() { let config = proptest::test_runner::Config::with_cases(10); let res = TestRunner::new(config).run(&any::(), move |value| { // Write `value` to the start of the 17th page (1 page after the 16 pages reserved for the - // Rust stack) + // Rust stack). Felts must be written in little endian order. let value_felts = value.to_felts(); let initializers = [Initializer::MemoryFelts { addr: write_to / 4, - felts: Cow::Borrowed(value_felts.as_slice()), + felts: Cow::Borrowed(&[value_felts[1], value_felts[0]]), }]; let args = [Felt::new(write_to as u64)]; let output = eval_package::(&package, initializers, &args, context.session(), |trace| { - let hi = - trace.read_memory_element(write_to / 4).unwrap_or_default().as_int() as u32; - let lo = trace.read_memory_element((write_to / 4) + 1).unwrap_or_default().as_int() - as u32; + let lo = trace.read_memory_element(write_to / 4).unwrap_or_default().as_int(); + let hi = trace.read_memory_element((write_to / 4) + 1).unwrap_or_default().as_int(); + log::trace!(target: "executor", "hi = {hi} ({hi:0x})"); log::trace!(target: "executor", "lo = {lo} ({lo:0x})"); - let stored = trace.read_from_rust_memory::(write_to).ok_or_else(|| { + + prop_assert_eq!(lo, value & 0xffffffff); + prop_assert_eq!(hi, value >> 32); + + let mut stored = trace.read_from_rust_memory::(write_to).ok_or_else(|| { TestCaseError::fail(format!( "expected {value} to have been written to byte address {write_to}, but \ read from that address failed" )) })?; + + // read_from_rust_memory() still reads in big-endian limbs. + stored = ((stored >> 32) & 0xffffffff) | (stored << 32); + prop_assert_eq!( stored, value, @@ -145,14 +152,14 @@ fn load_dw() { Ok(()) })?; - prop_assert_eq!(output, value); + prop_assert_eq!(output, value, "expected 0x{:x}; found 0x{:x}", value, output,); Ok(()) }); match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {value:?}"); + Err(TestError::Fail(reason, value)) => { + panic!("FAILURE: {}\nMinimal failing case: {value:?}", reason.message()); } Ok(_) => (), _ => panic!("Unexpected test result: {res:?}"), @@ -214,14 +221,14 @@ fn load_u8() { Ok(()) })?; - prop_assert_eq!(output, value); + prop_assert_eq!(output, value, "expected 0x{:x}; found 0x{:x}", value, output,); Ok(()) }); match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {value:?}"); + Err(TestError::Fail(reason, value)) => { + panic!("FAILURE: {}\nMinimal failing case: {value:?}", reason.message()); } Ok(_) => (), _ => panic!("Unexpected test result: {res:?}"), @@ -283,14 +290,14 @@ fn load_u16() { Ok(()) })?; - prop_assert_eq!(output, value); + prop_assert_eq!(output, value, "expected 0x{:x}; found 0x{:x}", value, output,); Ok(()) }); match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {value:?}"); + Err(TestError::Fail(reason, value)) => { + panic!("FAILURE: {}\nMinimal failing case: {value:?}", reason.message()); } Ok(_) => (), _ => panic!("Unexpected test result: {res:?}"), @@ -358,14 +365,14 @@ fn load_bool() { }, )?; - prop_assert_eq!(output, value); + prop_assert_eq!(output, value, "expected {}; found {}", output, value); Ok(()) }); match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {value:?}"); + Err(TestError::Fail(reason, value)) => { + panic!("FAILURE: {}\nMinimal failing case: {value:?}", reason.message()); } Ok(_) => (), _ => panic!("Unexpected test result: {res:?}"), @@ -502,8 +509,8 @@ fn store_u16() { ); match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {value:?}"); + Err(TestError::Fail(reason, value)) => { + panic!("FAILURE: {}\nMinimal failing case: {value:?}", reason.message()); } Ok(_) => (), _ => panic!("Unexpected test result: {res:?}"), @@ -724,8 +731,8 @@ fn store_u8() { ); match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {value:?}"); + Err(TestError::Fail(reason, value)) => { + panic!("FAILURE: {}\nMinimal failing case: {value:?}", reason.message()); } Ok(_) => (), _ => panic!("Unexpected test result: {res:?}"), @@ -821,15 +828,80 @@ fn store_unaligned_u32() { run_test(3, 0xaa332211, 0x88ddccbb); } +#[test] +fn load_unaligned_u64() { + // Use the start of the 17th page (1 page after the 16 pages reserved for the Rust stack) + let write_to = 17 * 2u32.pow(16); + + // Generate a `test` module with `main` function that loads from `write_to` + a passed offset. + let signature = Signature::new([AbiParam::new(Type::U32)], [AbiParam::new(Type::U64)]); + + // Compile once outside the test loop + let (package, context) = compile_test_module(signature, |builder| { + let block = builder.current_block(); + + // Get the offset, add it to the base address and load the 64bit value there. + let offs = block.borrow().arguments()[0] as ValueRef; + let base_addr = builder.u32(write_to, SourceSpan::default()); + let read_addr = builder.add(base_addr, offs, SourceSpan::default()).unwrap(); + let ptr = builder + .inttoptr(read_addr, Type::from(PointerType::new(Type::U64)), SourceSpan::default()) + .unwrap(); + let loaded = builder.load(ptr, SourceSpan::default()).unwrap(); + + // Return the value so we can assert that the output of execution matches + builder.ret(Some(loaded), SourceSpan::default()).unwrap(); + }); + + let run_test = |offs: u32, expected: u64| { + // Initialise memory with some known bytes. + let initializers = [Initializer::MemoryBytes { + addr: write_to, + bytes: &[ + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, + ], + }]; + + let output = eval_package::( + &package, + initializers, + &[Felt::new(offs as u64)], + context.session(), + |trace| { + // + let stack = trace.outputs(); + let hi: u64 = stack.get_stack_item(0).unwrap().into(); + let lo: u64 = stack.get_stack_item(1).unwrap().into(); + + eprintln!("hi limb = 0x{hi:08x}"); + eprintln!("lo limb = 0x{lo:08x}"); + + Ok(()) + }, + ) + .unwrap(); + + assert_eq!(output, expected); + }; + + run_test(0, 0x0807060504030201_u64); + run_test(1, 0x1108070605040302_u64); + run_test(2, 0x1211080706050403_u64); + run_test(3, 0x1312110807060504_u64); + run_test(4, 0x1413121108070605_u64); + run_test(5, 0x1514131211080706_u64); + run_test(6, 0x1615141312110807_u64); + run_test(7, 0x1716151413121108_u64); +} + #[test] fn store_unaligned_u64() { // Use the start of the 17th page (1 page after the 16 pages reserved for the Rust stack) let write_to = 17 * 2u32.pow(16); - // STORE_DW writes the high 32bit word to address and low 32bit word to address+1. - // So a .store() of 0xddccbbaa_cdabffee writes 0xddccbbaa to addr and 0xcdabffee to addr+1. - // Which in turn will be little-endian bytes [ AA BB CC DD EE FF AB CD ] at addr. - let write_val = 0xddccbbaa_cdabffee_u64; + // Value which in turn will be little-endian bytes [ AA BB CC DD EE FF AB CD ] at addr. + let write_val = 0xcdabffee_ddccbbaa_u64; // Generate a `test` module with `main` function that stores to a u32 offset. let signature = Signature::new( @@ -917,6 +989,12 @@ fn store_unaligned_u64() { assert_eq!(output, 1); }; + // Overwrite 01 02 03 04 05 06 07 08-11 12 13 14 15 16 17 18 + // with bytes aa bb cc dd ee ff ab cd at offset 0: + // Expect aa bb cc dd ee ff ab cd 11 12 13 14 15 16 17 18 + // or 0xccbbaa01, 0xabffeedd, 0x141312cd, 0x18171615 + run_test(0, 0xddccbbaa, 0xcdabffee, 0x14131211, 0x18171615); + // Overwrite 01 02 03 04 05 06 07 08-11 12 13 14 15 16 17 18 // with bytes aa bb cc dd ee ff ab cd at offset 1: // Expect 01 aa bb cc dd ee ff ab cd 12 13 14 15 16 17 18 diff --git a/tests/integration/src/rust_masm_tests/instructions.rs b/tests/integration/src/rust_masm_tests/instructions.rs index 326b07576..8efdcd509 100644 --- a/tests/integration/src/rust_masm_tests/instructions.rs +++ b/tests/integration/src/rust_masm_tests/instructions.rs @@ -87,13 +87,6 @@ macro_rules! test_wide_bin_op { let rs_out = a $op b; dbg!(&rs_out); - // Moves the little-endian 32bit limbs [A, B, C, D] to [D, C, B, A]. - let rs_out = ((rs_out >> 32) & 0xffffffff_00000000_00000000) - | ((rs_out & 0xffffffff_00000000_00000000) << 32) - | ((rs_out & 0xffffffff_00000000) >> 32) - | ((rs_out & 0xffffffff) << 32); - let rs_out_bytes = rs_out.to_le_bytes(); - // Write the operation result to 20 * PAGE_SIZE. let out_addr = 20u32 * 65536; @@ -104,11 +97,14 @@ macro_rules! test_wide_bin_op { dbg!(&args); eval_package::(&package, None, &args, &test.session, |trace| { - let vm_out: [u8; 16] = + let vm_out_bytes: [u8; 16] = trace.read_from_rust_memory(out_addr).expect("output was not written"); - dbg!(&vm_out); + dbg!(&vm_out_bytes); + + let rs_out_bytes = rs_out.to_le_bytes(); dbg!(&rs_out_bytes); - prop_assert_eq!(&rs_out_bytes, &vm_out, "VM output mismatch"); + + prop_assert_eq!(&rs_out_bytes, &vm_out_bytes, "VM output mismatch"); Ok(()) })?; @@ -253,6 +249,9 @@ test_int_op!(add, +, i8, 0..=i8::MAX/2, 0..=i8::MAX/2); // const WK1234: i128 = 79228162551157825753847955460000; // const WC1234: i128 = 7922816255115782575384795546000; // +// const WK1234H: i128 = 0x00001000_00002000_00003000_00004000; +// const WC1234H: i128 = 0x00000100_00000200_00000300_00000400; +// // test_wide_bin_op!(xxx, x, i128, i128, WK1234..=WK1234, WC1234..=WC1234); test_wide_bin_op!(add, +, u128, u128, 0..=u128::MAX/2, 0..=u128::MAX/2); From 8328937e93ee8d97a764ce8e554673f7afcee5bf Mon Sep 17 00:00:00 2001 From: Toby Hutton Date: Fri, 12 Dec 2025 10:57:08 +1100 Subject: [PATCH 30/70] Optimise the `realign_dw` memory intrinsic slightly. By changing the output to have the low word at the top we can avoid two `swap.1`s. --- codegen/masm/intrinsics/mem.masm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/codegen/masm/intrinsics/mem.masm b/codegen/masm/intrinsics/mem.masm index 5aaa3d1d4..a50c8bb33 100644 --- a/codegen/masm/intrinsics/mem.masm +++ b/codegen/masm/intrinsics/mem.masm @@ -229,7 +229,9 @@ end # to perform a sequence of shifts and masks to get the bits where they belong. This function # performs those steps, with the assumption that the caller has three values on the operand stack # representing any unaligned double-word value -export.realign_dw # [chunk_hi, chunk_mid, chunk_lo, offset] +# +# Stack transition is [chunk_hi, chunk_mid, chunk_lo, offset] -> [shifted_lo, shifted_hi] +export.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 @@ -283,9 +285,6 @@ export.realign_dw # [chunk_hi, chunk_mid, chunk_lo, offset] # OR the two halves together, giving us our second word, `x_lo` u32or # [x_lo, x_hi] - - # Swap the words so they are in the correct order - swap.1 # [x_hi, x_lo] end # Shift two 32-bit words by the given offset. @@ -330,13 +329,10 @@ export.load_dw # [addr, offset] 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 - # NOTE: realign_dw expects the hi, mid, lo word inputs and returns hi, lo (i.e., everything - # is 64-bit big-endian limb oriented), so we must swap the output to be in the correct order dup.0 mem_load # [e0, addr, bit_offset] dup.1 push.1 u32overflowing_add assertz mem_load # [e1, e0, addr, bit_offset] movup.2 push.2 u32overflowing_add assertz mem_load # [e2, e1, e0, bit_offset] exec.realign_dw - swap.1 end end From 57195e34bad485796046415601a6ee4d3822b4c5 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 26 Nov 2025 12:48:41 +0200 Subject: [PATCH 31/70] feature: reconstruct account `struct` from the `wit-bingen` generated bindings --- Cargo.lock | 2 + examples/auth-component-no-auth/Cargo.lock | 2 + .../auth-component-rpo-falcon512/Cargo.lock | 2 + examples/basic-wallet-tx-script/Cargo.lock | 2 + examples/basic-wallet/Cargo.lock | 2 + examples/counter-contract/Cargo.lock | 2 + examples/counter-note/Cargo.lock | 2 + examples/p2id-note/Cargo.lock | 2 + examples/p2id-note/src/lib.rs | 4 +- examples/p2ide-note/Cargo.lock | 2 + examples/storage-example/Cargo.lock | 2 + sdk/base-macros/Cargo.toml | 2 + sdk/base-macros/src/generate.rs | 672 ++++++++++++++++-- tests/rust-apps-wasm/rust-sdk/add/Cargo.lock | 2 + .../component-macros-account/Cargo.lock | 2 + .../rust-sdk/component-macros-note/Cargo.lock | 2 + .../cross-ctx-account-word-arg/Cargo.lock | 2 + .../cross-ctx-account-word/Cargo.lock | 2 + .../rust-sdk/cross-ctx-account/Cargo.lock | 2 + .../cross-ctx-note-word-arg/Cargo.lock | 2 + .../rust-sdk/cross-ctx-note-word/Cargo.lock | 2 + .../rust-sdk/cross-ctx-note/Cargo.lock | 2 + 22 files changed, 666 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7fa5dd716..4ac1cf291 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2278,6 +2278,8 @@ dependencies = [ "semver 1.0.27", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index a3106a54a..1347cb036 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -880,6 +880,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/auth-component-rpo-falcon512/Cargo.lock b/examples/auth-component-rpo-falcon512/Cargo.lock index 69b9a03c1..f0f96bb0a 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.lock +++ b/examples/auth-component-rpo-falcon512/Cargo.lock @@ -881,6 +881,8 @@ dependencies = [ "semver 1.0.27", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index a732370d1..b61a55f38 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index b7b698953..9b9ed7fe5 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index 94ff57c22..e6f8437f5 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index 6ebef5a68..9d5bc2547 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index c5530be26..8739e9261 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -866,6 +866,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index dcf57ef77..6987775fe 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -9,7 +9,7 @@ use miden::*; -use crate::bindings::miden::basic_wallet::basic_wallet::receive_asset; +use crate::bindings::miden::basic_wallet::basic_wallet::BasicWallet; #[note_script] fn run(_arg: Word) { @@ -23,6 +23,6 @@ fn run(_arg: Word) { let assets = active_note::get_assets(); for asset in assets { - receive_asset(asset); + BasicWallet::default().receive_asset(asset); } } diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index 5dc6b40e9..3c5c6af45 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -1064,6 +1064,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 60d375101..10fdfef34 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -866,6 +866,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] diff --git a/sdk/base-macros/Cargo.toml b/sdk/base-macros/Cargo.toml index d25ecb2db..ec6813973 100644 --- a/sdk/base-macros/Cargo.toml +++ b/sdk/base-macros/Cargo.toml @@ -22,6 +22,8 @@ semver.workspace = true toml.workspace = true syn.workspace = true heck.workspace = true +wit-bindgen-core = "0.46" +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 diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index eca0bff50..897b86254 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -4,12 +4,18 @@ use std::{ path::{Path, PathBuf}, }; -use proc_macro2::{Literal, Span, TokenStream as TokenStream2}; -use quote::quote; +use heck::ToUpperCamelCase; +use proc_macro2::{Span, TokenStream as TokenStream2}; +use quote::{quote, ToTokens}; use syn::{ parse::{Parse, ParseStream}, - Error, LitStr, Token, + parse_quote, + spanned::Spanned, + Attribute, Error, File, FnArg, ImplItem, ImplItemFn, Item, ItemFn, ItemImpl, ItemStruct, + LitStr, Pat, ReturnType, Token, }; +use wit_bindgen_core::wit_parser::{PackageId, Resolve, UnresolvedPackageGroup}; +use wit_bindgen_rust::{Opts, WithOption}; /// File name for the embedded Miden SDK WIT . const SDK_WIT_FILE_NAME: &str = "miden.wit"; @@ -19,7 +25,31 @@ pub(crate) const SDK_WIT_SOURCE: &str = include_str!("../wit/miden.wit"); #[derive(Default)] struct GenerateArgs { inline: Option, - with: Option, + /// Custom `with` entries parsed from the macro input. + /// Each entry maps a WIT interface/type to either `generate` or a Rust path. + /// Stored directly as `(String, WithOption)` to avoid an intermediate representation. + with_entries: Vec<(String, WithOption)>, +} + +/// Parses a single `with` entry like `"miden:foo/bar": generate` or `"miden:foo/bar": ::my::Path`. +fn parse_with_entry(input: ParseStream<'_>) -> syn::Result<(String, WithOption)> { + let key: LitStr = input.parse()?; + input.parse::()?; + let path: syn::Path = input.parse()?; + + // Check if the path is the special `generate` keyword + let option = if path.leading_colon.is_none() + && path.segments.len() == 1 + && path.segments.first().is_some_and(|seg| seg.ident == "generate") + { + WithOption::Generate + } else { + // Convert syn::Path to string, removing spaces for consistency + let path_str = path.to_token_stream().to_string().replace(' ', ""); + WithOption::Path(path_str) + }; + + Ok((key.value(), option)) } impl Parse for GenerateArgs { @@ -37,13 +67,18 @@ impl Parse for GenerateArgs { } args.inline = Some(input.parse()?); } else if name == "with" { - if args.with.is_some() { + if !args.with_entries.is_empty() { return Err(syn::Error::new(ident.span(), "duplicate `with` argument")); } let content; syn::braced!(content in input); - let tokens = content.parse::()?; - args.with = Some(tokens); + // Parse comma-separated with entries directly into (String, WithOption) pairs + while !content.is_empty() { + args.with_entries.push(parse_with_entry(&content)?); + if content.peek(Token![,]) { + content.parse::()?; + } + } } else { return Err(syn::Error::new( ident.span(), @@ -88,12 +123,6 @@ pub(crate) fn expand(input: proc_macro::TokenStream) -> proc_macro::TokenStream .into(); } - let path_literals: Vec<_> = - config.paths.iter().map(|path| Literal::string(path)).collect(); - - let inline_clause = args.inline.as_ref().map(|src| quote! { inline: #src, }); - let custom_with_entries = args.with.unwrap_or_else(TokenStream2::new); - let inline_world = args .inline .as_ref() @@ -109,47 +138,339 @@ pub(crate) fn expand(input: proc_macro::TokenStream) -> proc_macro::TokenStream .into(); } - let world_clause = world_value.as_ref().map(|world| { - let literal = Literal::string(world); - quote! { world: #literal, } - }); - - quote! { - // Wrap the bindings in the `bindings` module since `generate!` makes a top level - // module named after the package namespace which is `miden` for all our projects - // so its conflicts with the `miden` crate (SDK) - #[doc(hidden)] - #[allow(dead_code)] - pub mod bindings { - ::miden::wit_bindgen::generate!({ - #inline_clause - #world_clause - path: [#(#path_literals),*], - generate_all, - runtime_path: "::miden::wit_bindgen::rt", - // path to use in the generated `export!` macro - default_bindings_module: "bindings", - with: { - #custom_with_entries - "miden:base/core-types@1.0.0": generate, - "miden:base/core-types@1.0.0/felt": ::miden::Felt, - "miden:base/core-types@1.0.0/word": ::miden::Word, - "miden:base/core-types@1.0.0/asset": ::miden::Asset, - "miden:base/core-types@1.0.0/account-id": ::miden::AccountId, - "miden:base/core-types@1.0.0/tag": ::miden::Tag, - "miden:base/core-types@1.0.0/note-type": ::miden::NoteType, - "miden:base/core-types@1.0.0/recipient": ::miden::Recipient, - "miden:base/core-types@1.0.0/note-idx": ::miden::NoteIdx, - }, - }); - } + match generate_bindings(&args, &config, world_value.as_deref()) { + Ok(raw_bindings) => match augment_generated_bindings(raw_bindings) { + Ok(augmented) => { + quote! { + // Wrap the bindings in the `bindings` module since `generate!` makes a top level + // module named after the package namespace which is `miden` for all our projects + // so it conflicts with the `miden` crate (SDK) + #[doc(hidden)] + #[allow(dead_code)] + pub mod bindings { + #augmented + } + } + .into() + } + Err(err) => err.to_compile_error().into(), + }, + Err(err) => err.to_compile_error().into(), } - .into() } Err(err) => err.to_compile_error().into(), } } +fn generate_bindings( + args: &GenerateArgs, + config: &manifest_paths::ResolvedWit, + world_override: Option<&str>, +) -> Result { + let inline_src = args.inline.as_ref().map(|src| src.value()); + let inline_ref = inline_src.as_deref(); + let wit_sources = load_wit_sources(&config.paths, inline_ref)?; + + let world_spec = world_override.or(config.world.as_deref()); + let world = wit_sources + .resolve + .select_world(&wit_sources.packages, world_spec) + .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; + + let mut opts = Opts { + generate_all: true, + runtime_path: Some("::miden::wit_bindgen::rt".to_string()), + default_bindings_module: Some("bindings".to_string()), + ..Opts::default() + }; + apply_with_entries(&mut opts, &args.with_entries); + push_default_with_entries(&mut opts); + + let mut generated_files = wit_bindgen_core::Files::default(); + let mut generator = opts.build(); + generator + .generate(&wit_sources.resolve, world, &mut generated_files) + .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; + + let (_, src_bytes) = generated_files + .iter() + .next() + .ok_or_else(|| Error::new(Span::call_site(), "wit-bindgen emitted no bindings"))?; + let src = std::str::from_utf8(src_bytes) + .map_err(|err| Error::new(Span::call_site(), format!("invalid UTF-8: {err}")))?; + let mut tokens: TokenStream2 = src + .parse() + .map_err(|err| Error::new(Span::call_site(), format!("failed to parse bindings: {err}")))?; + + // Include a dummy `include_bytes!` for any files we read so rustc knows that + // we depend on the contents of those files. + for path in wit_sources.files_read { + let utf8_path = path.to_str().ok_or_else(|| { + Error::new( + Span::call_site(), + format!("path '{}' contains invalid UTF-8", path.display()), + ) + })?; + tokens.extend(quote! { + const _: &[u8] = include_bytes!(#utf8_path); + }); + } + + Ok(tokens) +} + +fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result { + let mut file: File = syn::parse2(tokens)?; + transform_modules(&mut file.items, &mut Vec::new())?; + Ok(file.into_token_stream()) +} + +/// Result of loading WIT sources. +struct LoadedWitSources { + /// The resolved WIT definitions. + resolve: Resolve, + /// Package IDs to use for world selection. + packages: Vec, + /// File paths that were read to include a dummy `include_bytes!` so rustc knows that we depend + /// on the contents of those files. + files_read: Vec, +} + +/// Loads WIT sources from file paths and optionally an inline source. +fn load_wit_sources( + paths: &[String], + inline_source: Option<&str>, +) -> Result { + let manifest_dir = env::var("CARGO_MANIFEST_DIR").map_err(|err| { + Error::new(Span::call_site(), format!("failed to read CARGO_MANIFEST_DIR: {err}")) + })?; + let manifest_dir = PathBuf::from(manifest_dir); + + let mut resolve = Resolve::default(); + let mut packages = Vec::new(); + let mut files = Vec::new(); + + // Load WIT definitions from file paths. These are always loaded to populate the resolver + // with type definitions that the inline source may depend on. + for path in paths { + let path_buf = PathBuf::from(path); + let absolute = if path_buf.is_absolute() { + path_buf + } else { + manifest_dir.join(path_buf) + }; + let normalized = fs::canonicalize(&absolute).unwrap_or(absolute); + let (pkg, sources) = resolve + .push_path(normalized.clone()) + .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; + packages.push(pkg); + files.extend(sources.paths().map(|p| p.to_owned())); + } + + if let Some(src) = inline_source { + // When inline source is provided, it becomes the primary package for world selection. + // We clear previously collected package IDs because the inline source defines the world + // we want to generate bindings for. The file-based packages are still loaded above and + // remain in the resolver - they provide type definitions that the inline world imports. + packages.clear(); + let group = UnresolvedPackageGroup::parse("inline", src) + .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; + let pkg = resolve + .push_group(group) + .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; + packages.push(pkg); + } + + Ok(LoadedWitSources { + resolve, + packages, + files_read: files, + }) +} + +/// Applies user-provided `with` entries to the wit-bindgen options. +fn apply_with_entries(opts: &mut Opts, entries: &[(String, WithOption)]) { + opts.with.extend(entries.iter().cloned()); +} + +fn push_default_with_entries(opts: &mut Opts) { + opts.with + .push(("miden:base/core-types@1.0.0".to_string(), WithOption::Generate)); + push_path_entry(opts, "miden:base/core-types@1.0.0/felt", "::miden::Felt"); + push_path_entry(opts, "miden:base/core-types@1.0.0/word", "::miden::Word"); + push_path_entry(opts, "miden:base/core-types@1.0.0/asset", "::miden::Asset"); + push_path_entry(opts, "miden:base/core-types@1.0.0/account-id", "::miden::AccountId"); + push_path_entry(opts, "miden:base/core-types@1.0.0/tag", "::miden::Tag"); + push_path_entry(opts, "miden:base/core-types@1.0.0/note-type", "::miden::NoteType"); + push_path_entry(opts, "miden:base/core-types@1.0.0/recipient", "::miden::Recipient"); + push_path_entry(opts, "miden:base/core-types@1.0.0/note-idx", "::miden::NoteIdx"); +} + +fn push_path_entry(opts: &mut Opts, key: &str, value: &str) { + opts.with.push((key.to_string(), WithOption::Path(value.to_string()))); +} + +fn transform_modules(items: &mut [Item], path: &mut Vec) -> syn::Result<()> { + for item in items.iter_mut() { + if let Item::Mod(module) = item { + path.push(module.ident.clone()); + if let Some((_, ref mut content)) = module.content { + transform_modules(content, path)?; + maybe_inject_struct_wrapper(content, path)?; + } + path.pop(); + } + } + + Ok(()) +} + +/// Injects a wrapper struct and impl block for public functions in a module. +/// +/// Note: We need `&mut Vec` here (not `&mut [Item]`) because we push new items +/// (the struct and impl block) to the vector. +fn maybe_inject_struct_wrapper(items: &mut Vec, path: &[syn::Ident]) -> syn::Result<()> { + if !should_generate_struct(path) { + return Ok(()); + } + + let functions: Vec = items + .iter() + .filter_map(|item| match item { + Item::Fn(func) if is_target_function(func) => Some(func.clone()), + _ => None, + }) + .collect(); + + if functions.is_empty() { + return Ok(()); + } + + let module_ident = + path.last().ok_or_else(|| Error::new(Span::call_site(), "empty module path"))?; + let struct_ident = + syn::Ident::new(&module_ident.to_string().to_upper_camel_case(), module_ident.span()); + + if items + .iter() + .any(|item| matches!(item, Item::Struct(existing) if existing.ident == struct_ident)) + { + return Ok(()); + } + + let struct_doc = + format!("Wrapper for functions defined in module `{}`.", format_module_path(path)); + let struct_item: ItemStruct = parse_quote! { + #[doc = #struct_doc] + #[derive(Clone, Copy, Default)] + pub struct #struct_ident; + }; + + let mut methods = Vec::new(); + for func in functions { + methods.push(build_wrapper_method(&func, path)?); + } + + if methods.is_empty() { + return Ok(()); + } + + let mut impl_item: ItemImpl = parse_quote! { + impl #struct_ident {} + }; + impl_item.items.extend(methods.into_iter().map(ImplItem::Fn)); + + items.push(Item::Struct(struct_item)); + items.push(Item::Impl(impl_item)); + + Ok(()) +} + +fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Result { + let mut sig = func.sig.clone(); + sig.inputs.insert(0, parse_quote!(&self)); + + let arg_idents = collect_arg_idents(func)?; + let call_expr = wrapper_call_tokens(module_path, &sig.ident, &arg_idents); + + let method_doc = format!("Calls `{}` from `{}`.", sig.ident, format_module_path(module_path)); + let doc_attr: Attribute = parse_quote!(#[doc = #method_doc]); + let inline_attr: Attribute = parse_quote!(#[inline(always)]); + let allow_unused_attr: Attribute = parse_quote!(#[allow(unused_variables)]); + + let body_tokens = match &sig.output { + ReturnType::Default => quote!({ #call_expr; }), + _ => quote!({ #call_expr }), + }; + let block = syn::parse2(body_tokens)?; + + Ok(ImplItemFn { + attrs: vec![doc_attr, inline_attr, allow_unused_attr], + vis: func.vis.clone(), + defaultness: None, + sig, + block, + }) +} + +fn collect_arg_idents(func: &ItemFn) -> syn::Result> { + func.sig + .inputs + .iter() + .map(|arg| match arg { + FnArg::Receiver(_) => { + Err(Error::new(func.sig.ident.span(), "unexpected receiver in generated function")) + } + FnArg::Typed(pat_type) => match pat_type.pat.as_ref() { + Pat::Ident(pat_ident) => Ok(pat_ident.ident.clone()), + other => Err(Error::new( + other.span(), + "unsupported argument pattern in generated function", + )), + }, + }) + .collect() +} + +fn wrapper_call_tokens( + module_path: &[syn::Ident], + fn_ident: &syn::Ident, + args: &[syn::Ident], +) -> TokenStream2 { + let mut path_tokens = quote! { crate::bindings }; + for ident in module_path { + let current = ident.clone(); + path_tokens = quote! { #path_tokens :: #current }; + } + + quote! { #path_tokens :: #fn_ident(#(#args),*) } +} + +fn should_generate_struct(path: &[syn::Ident]) -> bool { + if path.is_empty() { + return false; + } + let first = path[0].to_string(); + if first == "exports" { + return false; + } + if first.starts_with('_') { + return false; + } + let last = path.last().unwrap().to_string(); + !last.starts_with('_') +} + +fn is_target_function(func: &ItemFn) -> bool { + matches!(func.vis, syn::Visibility::Public(_)) + && func.sig.unsafety.is_none() + && !func.sig.ident.to_string().starts_with('_') +} + +fn format_module_path(path: &[syn::Ident]) -> String { + path.iter().map(|ident| ident.to_string()).collect::>().join("::") +} + mod manifest_paths { use toml::Value; @@ -440,3 +761,258 @@ mod manifest_paths { } } } + +#[cfg(test)] +mod tests { + use super::*; + + /// Helper to parse Rust source into a syn::File. + fn parse_file(src: &str) -> File { + syn::parse_str(src).expect("failed to parse test source") + } + + #[test] + fn test_should_generate_struct_empty_path() { + assert!(!should_generate_struct(&[])); + } + + #[test] + fn test_should_generate_struct_exports_excluded() { + let path = vec![syn::Ident::new("exports", Span::call_site())]; + assert!(!should_generate_struct(&path)); + + let path = vec![ + syn::Ident::new("exports", Span::call_site()), + syn::Ident::new("foo", Span::call_site()), + ]; + assert!(!should_generate_struct(&path)); + } + + #[test] + fn test_should_generate_struct_underscore_excluded() { + let path = vec![syn::Ident::new("_private", Span::call_site())]; + assert!(!should_generate_struct(&path)); + + let path = vec![ + syn::Ident::new("miden", Span::call_site()), + syn::Ident::new("_internal", Span::call_site()), + ]; + assert!(!should_generate_struct(&path)); + } + + #[test] + fn test_should_generate_struct_valid_paths() { + let path = vec![syn::Ident::new("miden", Span::call_site())]; + assert!(should_generate_struct(&path)); + + let path = vec![ + syn::Ident::new("miden", Span::call_site()), + syn::Ident::new("basic_wallet", Span::call_site()), + ]; + assert!(should_generate_struct(&path)); + } + + #[test] + fn test_is_target_function_public() { + let func: ItemFn = syn::parse_quote! { + pub fn receive_asset(asset: Asset) {} + }; + assert!(is_target_function(&func)); + } + + #[test] + fn test_is_target_function_private_excluded() { + let func: ItemFn = syn::parse_quote! { + fn private_fn() {} + }; + assert!(!is_target_function(&func)); + } + + #[test] + fn test_is_target_function_unsafe_excluded() { + let func: ItemFn = syn::parse_quote! { + pub unsafe fn unsafe_fn() {} + }; + assert!(!is_target_function(&func)); + } + + #[test] + fn test_is_target_function_underscore_excluded() { + let func: ItemFn = syn::parse_quote! { + pub fn _internal() {} + }; + assert!(!is_target_function(&func)); + } + + #[test] + fn test_format_module_path() { + let path = vec![ + syn::Ident::new("miden", Span::call_site()), + syn::Ident::new("basic_wallet", Span::call_site()), + ]; + assert_eq!(format_module_path(&path), "miden::basic_wallet"); + } + + #[test] + fn test_format_module_path_empty() { + assert_eq!(format_module_path(&[]), ""); + } + + #[test] + fn test_collect_arg_idents() { + let func: ItemFn = syn::parse_quote! { + pub fn foo(a: u32, b: String, c: Vec) {} + }; + let idents = collect_arg_idents(&func).unwrap(); + let names: Vec<_> = idents.iter().map(|i| i.to_string()).collect(); + assert_eq!(names, vec!["a", "b", "c"]); + } + + #[test] + fn test_collect_arg_idents_empty() { + let func: ItemFn = syn::parse_quote! { + pub fn no_args() {} + }; + let idents = collect_arg_idents(&func).unwrap(); + assert!(idents.is_empty()); + } + + #[test] + fn test_transform_modules_injects_struct() { + let src = r#" + mod miden { + mod basic_wallet { + mod basic_wallet { + pub fn receive_asset(asset: Asset) {} + pub fn send_asset(asset: Asset) {} + } + } + } + "#; + let mut file = parse_file(src); + transform_modules(&mut file.items, &mut Vec::new()).unwrap(); + + // Check that the innermost module now contains a struct and impl + let miden_mod = match &file.items[0] { + Item::Mod(m) => m, + _ => panic!("expected mod"), + }; + let basic_wallet_outer = match &miden_mod.content.as_ref().unwrap().1[0] { + Item::Mod(m) => m, + _ => panic!("expected mod"), + }; + let basic_wallet_inner = match &basic_wallet_outer.content.as_ref().unwrap().1[0] { + Item::Mod(m) => m, + _ => panic!("expected mod"), + }; + let inner_items = &basic_wallet_inner.content.as_ref().unwrap().1; + + // Should have: 2 functions + 1 struct + 1 impl = 4 items + assert_eq!(inner_items.len(), 4); + + // Check struct exists and has correct name + let struct_item = inner_items.iter().find_map(|item| match item { + Item::Struct(s) => Some(s), + _ => None, + }); + assert!(struct_item.is_some()); + assert_eq!(struct_item.unwrap().ident.to_string(), "BasicWallet"); + + // Check impl exists + let impl_item = inner_items.iter().find_map(|item| match item { + Item::Impl(i) => Some(i), + _ => None, + }); + assert!(impl_item.is_some()); + let impl_block = impl_item.unwrap(); + // Should have 2 methods + assert_eq!(impl_block.items.len(), 2); + } + + #[test] + fn test_transform_modules_skips_exports() { + let src = r#" + mod exports { + mod my_component { + pub fn exported_fn() {} + } + } + "#; + let mut file = parse_file(src); + transform_modules(&mut file.items, &mut Vec::new()).unwrap(); + + // exports module should not have any struct injected + let exports_mod = match &file.items[0] { + Item::Mod(m) => m, + _ => panic!("expected mod"), + }; + let my_component = match &exports_mod.content.as_ref().unwrap().1[0] { + Item::Mod(m) => m, + _ => panic!("expected mod"), + }; + let items = &my_component.content.as_ref().unwrap().1; + + // Should only have the original function, no struct added + assert_eq!(items.len(), 1); + assert!(matches!(items[0], Item::Fn(_))); + } + + #[test] + fn test_transform_modules_skips_empty_modules() { + let src = r#" + mod miden { + mod empty_module { + } + } + "#; + let mut file = parse_file(src); + transform_modules(&mut file.items, &mut Vec::new()).unwrap(); + + let miden_mod = match &file.items[0] { + Item::Mod(m) => m, + _ => panic!("expected mod"), + }; + let empty_module = match &miden_mod.content.as_ref().unwrap().1[0] { + Item::Mod(m) => m, + _ => panic!("expected mod"), + }; + let items = &empty_module.content.as_ref().unwrap().1; + + // Should remain empty + assert!(items.is_empty()); + } + + #[test] + fn test_build_wrapper_method_signature() { + let func: ItemFn = syn::parse_quote! { + pub fn receive_asset(asset: Asset) {} + }; + let path = vec![ + syn::Ident::new("miden", Span::call_site()), + syn::Ident::new("basic_wallet", Span::call_site()), + ]; + let method = build_wrapper_method(&func, &path).unwrap(); + + // Method should have &self as first parameter + assert_eq!(method.sig.inputs.len(), 2); + assert!(matches!(method.sig.inputs.first(), Some(FnArg::Receiver(_)))); + + // Should be public + assert!(matches!(method.vis, syn::Visibility::Public(_))); + + // Should have inline attribute + assert!(method.attrs.iter().any(|attr| { attr.path().is_ident("inline") })); + } + + #[test] + fn test_build_wrapper_method_with_return_type() { + let func: ItemFn = syn::parse_quote! { + pub fn get_value() -> u32 { 42 } + }; + let path = vec![syn::Ident::new("test_mod", Span::call_site())]; + let method = build_wrapper_method(&func, &path).unwrap(); + + // Return type should be preserved + assert!(matches!(method.sig.output, ReturnType::Type(_, _))); + } +} diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index c221a348a..5891e0a4a 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -866,6 +866,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] 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 3707ae2a0..7dc8f3d9e 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 @@ -886,6 +886,8 @@ dependencies = [ "semver 1.0.27", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[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 863bc24c8..a81a3cfa8 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 @@ -886,6 +886,8 @@ dependencies = [ "semver 1.0.27", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] 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 e5e8eab32..22ceac4c7 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 @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[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 5ea05f47b..8a552f1c8 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 @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[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 1881f4ec9..430ae8693 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 @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[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 8a557f7fe..2a5e8e74b 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 @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[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 96af9c888..2374b4622 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 @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[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 4a4be16ab..bd187420d 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 @@ -873,6 +873,8 @@ dependencies = [ "semver 1.0.26", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] From 7a8506be995f2f59b251ce7748dfbd3618e0a370 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 26 Nov 2025 13:47:27 +0200 Subject: [PATCH 32/70] refactor: refine names, doc comments --- examples/p2id-note/src/lib.rs | 3 +- sdk/base-macros/src/generate.rs | 49 ++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 6987775fe..40277189a 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -21,8 +21,9 @@ fn run(_arg: Word) { let current_account = active_account::get_id(); assert_eq!(current_account, target_account); + let wallet = BasicWallet::default(); let assets = active_note::get_assets(); for asset in assets { - BasicWallet::default().receive_asset(asset); + wallet.receive_asset(asset); } } diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 897b86254..051333447 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -162,6 +162,7 @@ pub(crate) fn expand(input: proc_macro::TokenStream) -> proc_macro::TokenStream } } +/// Generates WIT bindings using `wit-bindgen` directly instead of the `generate!` macro. fn generate_bindings( args: &GenerateArgs, config: &manifest_paths::ResolvedWit, @@ -183,7 +184,7 @@ fn generate_bindings( default_bindings_module: Some("bindings".to_string()), ..Opts::default() }; - apply_with_entries(&mut opts, &args.with_entries); + push_custom_with_entries(&mut opts, &args.with_entries); push_default_with_entries(&mut opts); let mut generated_files = wit_bindgen_core::Files::default(); @@ -219,6 +220,12 @@ fn generate_bindings( Ok(tokens) } +/// Post-processes wit-bindgen output to inject wrapper structs for imported interfaces. +/// +/// This transforms the raw bindings by walking all modules and injecting a wrapper struct +/// with methods that delegate to the generated free functions. This provides a more +/// ergonomic API (e.g., `BasicWallet::default().receive_asset(asset)` instead of +/// `basic_wallet::receive_asset(asset)`). fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result { let mut file: File = syn::parse2(tokens)?; transform_modules(&mut file.items, &mut Vec::new())?; @@ -288,11 +295,12 @@ fn load_wit_sources( }) } -/// Applies user-provided `with` entries to the wit-bindgen options. -fn apply_with_entries(opts: &mut Opts, entries: &[(String, WithOption)]) { +/// Pushes user-provided `with` entries to the wit-bindgen options. +fn push_custom_with_entries(opts: &mut Opts, entries: &[(String, WithOption)]) { opts.with.extend(entries.iter().cloned()); } +/// Pushes default `with` entries that map Miden base types to SDK types. fn push_default_with_entries(opts: &mut Opts) { opts.with .push(("miden:base/core-types@1.0.0".to_string(), WithOption::Generate)); @@ -310,6 +318,9 @@ fn push_path_entry(opts: &mut Opts, key: &str, value: &str) { opts.with.push((key.to_string(), WithOption::Path(value.to_string()))); } +/// Recursively walks all modules and injects wrapper structs where appropriate. +/// +/// The `path` parameter tracks the current module path for naming and call generation. fn transform_modules(items: &mut [Item], path: &mut Vec) -> syn::Result<()> { for item in items.iter_mut() { if let Item::Mod(module) = item { @@ -386,6 +397,7 @@ fn maybe_inject_struct_wrapper(items: &mut Vec, path: &[syn::Ident]) -> sy Ok(()) } +/// Builds a wrapper method that delegates to the original free function. fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Result { let mut sig = func.sig.clone(); sig.inputs.insert(0, parse_quote!(&self)); @@ -413,6 +425,10 @@ fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Resul }) } +/// Extracts argument identifiers from a function signature. +/// +/// Returns an error if the function contains a receiver (`self`) or uses +/// unsupported argument patterns (e.g., destructuring patterns). fn collect_arg_idents(func: &ItemFn) -> syn::Result> { func.sig .inputs @@ -425,13 +441,17 @@ fn collect_arg_idents(func: &ItemFn) -> syn::Result> { Pat::Ident(pat_ident) => Ok(pat_ident.ident.clone()), other => Err(Error::new( other.span(), - "unsupported argument pattern in generated function", + format!( + "unsupported argument pattern `{}` in generated function", + quote!(#other) + ), )), }, }) .collect() } +/// Generates tokens for calling the original free function from the wrapper method. fn wrapper_call_tokens( module_path: &[syn::Ident], fn_ident: &syn::Ident, @@ -439,13 +459,18 @@ fn wrapper_call_tokens( ) -> TokenStream2 { let mut path_tokens = quote! { crate::bindings }; for ident in module_path { - let current = ident.clone(); - path_tokens = quote! { #path_tokens :: #current }; + path_tokens = quote! { #path_tokens :: #ident }; } quote! { #path_tokens :: #fn_ident(#(#args),*) } } +/// Determines whether a wrapper struct should be generated for the given module path. +/// +/// Returns `false` for: +/// - Empty paths +/// - `exports` modules (these are user-implemented exports, not imports) +/// - Modules starting with underscore (internal/private modules) fn should_generate_struct(path: &[syn::Ident]) -> bool { if path.is_empty() { return false; @@ -461,12 +486,16 @@ fn should_generate_struct(path: &[syn::Ident]) -> bool { !last.starts_with('_') } +/// Determines whether a function should have a wrapper method generated. +/// +/// Returns `true` for public, safe functions that don't start with underscore. fn is_target_function(func: &ItemFn) -> bool { matches!(func.vis, syn::Visibility::Public(_)) && func.sig.unsafety.is_none() && !func.sig.ident.to_string().starts_with('_') } +/// Formats a module path as a `::` separated string for use in documentation. fn format_module_path(path: &[syn::Ident]) -> String { path.iter().map(|ident| ident.to_string()).collect::>().join("::") } @@ -815,7 +844,7 @@ mod tests { #[test] fn test_is_target_function_public() { let func: ItemFn = syn::parse_quote! { - pub fn receive_asset(asset: Asset) {} + pub fn receive_asset(asset: u64) {} }; assert!(is_target_function(&func)); } @@ -883,8 +912,8 @@ mod tests { mod miden { mod basic_wallet { mod basic_wallet { - pub fn receive_asset(asset: Asset) {} - pub fn send_asset(asset: Asset) {} + pub fn receive_asset(asset: u64) {} + pub fn send_asset(asset: u64) {} } } } @@ -985,7 +1014,7 @@ mod tests { #[test] fn test_build_wrapper_method_signature() { let func: ItemFn = syn::parse_quote! { - pub fn receive_asset(asset: Asset) {} + pub fn receive_asset(asset: u64) {} }; let path = vec![ syn::Ident::new("miden", Span::call_site()), From 8e9f230bc710143fdff66475f63f6df265790180 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 26 Nov 2025 13:58:02 +0200 Subject: [PATCH 33/70] refactor: generate `struct` only from the leaf modules --- sdk/base-macros/src/generate.rs | 51 ++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 051333447..7ca2cc890 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -336,12 +336,16 @@ fn transform_modules(items: &mut [Item], path: &mut Vec) -> syn::Res Ok(()) } -/// Injects a wrapper struct and impl block for public functions in a module. +/// Injects a wrapper struct and impl block for public functions in a leaf module. +/// +/// A leaf module is one that contains no nested modules. Only leaf modules get wrapper +/// structs generated, as non-leaf modules typically represent namespace hierarchy rather +/// than concrete interfaces. /// /// Note: We need `&mut Vec` here (not `&mut [Item]`) because we push new items /// (the struct and impl block) to the vector. fn maybe_inject_struct_wrapper(items: &mut Vec, path: &[syn::Ident]) -> syn::Result<()> { - if !should_generate_struct(path) { + if !should_generate_struct(path, items) { return Ok(()); } @@ -465,13 +469,14 @@ fn wrapper_call_tokens( quote! { #path_tokens :: #fn_ident(#(#args),*) } } -/// Determines whether a wrapper struct should be generated for the given module path. +/// Determines whether a wrapper struct should be generated for the given module. /// /// Returns `false` for: /// - Empty paths /// - `exports` modules (these are user-implemented exports, not imports) /// - Modules starting with underscore (internal/private modules) -fn should_generate_struct(path: &[syn::Ident]) -> bool { +/// - Non-leaf modules (modules that contain nested modules) +fn should_generate_struct(path: &[syn::Ident], items: &[Item]) -> bool { if path.is_empty() { return false; } @@ -483,7 +488,11 @@ fn should_generate_struct(path: &[syn::Ident]) -> bool { return false; } let last = path.last().unwrap().to_string(); - !last.starts_with('_') + if last.starts_with('_') { + return false; + } + // Only generate for leaf modules (no nested modules) + !items.iter().any(|item| matches!(item, Item::Mod(_))) } /// Determines whether a function should have a wrapper method generated. @@ -802,43 +811,59 @@ mod tests { #[test] fn test_should_generate_struct_empty_path() { - assert!(!should_generate_struct(&[])); + let empty_items: Vec = vec![]; + assert!(!should_generate_struct(&[], &empty_items)); } #[test] fn test_should_generate_struct_exports_excluded() { + let empty_items: Vec = vec![]; let path = vec![syn::Ident::new("exports", Span::call_site())]; - assert!(!should_generate_struct(&path)); + assert!(!should_generate_struct(&path, &empty_items)); let path = vec![ syn::Ident::new("exports", Span::call_site()), syn::Ident::new("foo", Span::call_site()), ]; - assert!(!should_generate_struct(&path)); + assert!(!should_generate_struct(&path, &empty_items)); } #[test] fn test_should_generate_struct_underscore_excluded() { + let empty_items: Vec = vec![]; let path = vec![syn::Ident::new("_private", Span::call_site())]; - assert!(!should_generate_struct(&path)); + assert!(!should_generate_struct(&path, &empty_items)); let path = vec![ syn::Ident::new("miden", Span::call_site()), syn::Ident::new("_internal", Span::call_site()), ]; - assert!(!should_generate_struct(&path)); + assert!(!should_generate_struct(&path, &empty_items)); } #[test] - fn test_should_generate_struct_valid_paths() { + fn test_should_generate_struct_valid_leaf_modules() { + let empty_items: Vec = vec![]; let path = vec![syn::Ident::new("miden", Span::call_site())]; - assert!(should_generate_struct(&path)); + assert!(should_generate_struct(&path, &empty_items)); let path = vec![ syn::Ident::new("miden", Span::call_site()), syn::Ident::new("basic_wallet", Span::call_site()), ]; - assert!(should_generate_struct(&path)); + assert!(should_generate_struct(&path, &empty_items)); + } + + #[test] + fn test_should_generate_struct_non_leaf_excluded() { + let path = vec![syn::Ident::new("miden", Span::call_site())]; + // Items containing a nested module + let items_with_mod: Vec = vec![syn::parse_quote! { mod nested {} }]; + assert!(!should_generate_struct(&path, &items_with_mod)); + + // Items with only functions (leaf module) should be allowed + let items_with_fn: Vec = vec![syn::parse_quote! { pub fn foo() {} }]; + assert!(should_generate_struct(&path, &items_with_fn)); } #[test] From 61e0933739a5e209f73ec94666d4b98944037cb9 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 26 Nov 2025 14:21:40 +0200 Subject: [PATCH 34/70] feature: pass the generated `struct` as `fn run` parameter --- examples/basic-wallet-tx-script/src/lib.rs | 9 +- examples/p2id-note/src/lib.rs | 5 +- sdk/base-macros/src/script.rs | 125 ++++++++++++++++----- 3 files changed, 103 insertions(+), 36 deletions(-) diff --git a/examples/basic-wallet-tx-script/src/lib.rs b/examples/basic-wallet-tx-script/src/lib.rs index 469d59a88..220644b10 100644 --- a/examples/basic-wallet-tx-script/src/lib.rs +++ b/examples/basic-wallet-tx-script/src/lib.rs @@ -10,7 +10,7 @@ use miden::{intrinsics::advice::adv_push_mapvaln, *}; -use crate::bindings::miden::basic_wallet::basic_wallet; +use crate::bindings::miden::basic_wallet::basic_wallet::BasicWallet; // Input layout constants const TAG_INDEX: usize = 0; @@ -23,7 +23,7 @@ const ASSET_START: usize = 8; const ASSET_END: usize = 12; #[tx_script] -fn run(arg: Word) { +fn run(arg: Word, account: BasicWallet) { let num_felts = adv_push_mapvaln(arg.clone()); let num_felts_u64 = num_felts.as_u64(); assert_eq(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); @@ -35,7 +35,8 @@ fn run(arg: Word) { 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(), aux, note_type.into(), execution_hint, recipient.into()); let asset: [Felt; 4] = input[ASSET_START..ASSET_END].try_into().unwrap(); - basic_wallet::move_asset_to_note(asset.into(), note_idx); + account.move_asset_to_note(asset.into(), note_idx); } diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 40277189a..8af786700 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -12,7 +12,7 @@ use miden::*; use crate::bindings::miden::basic_wallet::basic_wallet::BasicWallet; #[note_script] -fn run(_arg: Word) { +fn run(_arg: Word, account: BasicWallet) { let inputs = active_note::get_inputs(); let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; @@ -21,9 +21,8 @@ fn run(_arg: Word) { let current_account = active_account::get_id(); assert_eq!(current_account, target_account); - let wallet = BasicWallet::default(); let assets = active_note::get_assets(); for asset in assets { - wallet.receive_asset(asset); + account.receive_asset(asset); } } diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index 8d82a080c..ac1d81abe 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -2,7 +2,7 @@ use std::{env, fs, path::Path}; use proc_macro2::{Literal, Span}; use quote::quote; -use syn::{parse_macro_input, spanned::Spanned, FnArg, ItemFn, Pat, PatIdent}; +use syn::{parse_macro_input, spanned::Spanned, FnArg, ItemFn, Pat, PatIdent, Type}; use toml::Value; use crate::{boilerplate::runtime_boilerplate, util::generated_wit_folder_at}; @@ -44,27 +44,12 @@ pub(crate) fn expand( .into(); } - let mut call_args: Vec = Vec::new(); - for arg in &input_fn.sig.inputs { - match arg { - FnArg::Typed(pat_type) => match pat_type.pat.as_ref() { - Pat::Ident(PatIdent { ident, .. }) => call_args.push(ident.clone()), - other => { - return syn::Error::new( - other.span(), - "function arguments must be simple identifiers", - ) - .into_compile_error() - .into(); - } - }, - FnArg::Receiver(receiver) => { - return syn::Error::new(receiver.span(), "unexpected receiver argument") - .into_compile_error() - .into(); - } - } - } + // Parse function arguments, separating the first trait-required argument from + // additional "injected" arguments that will be instantiated by the macro. + let parsed_args = match parse_fn_args(&input_fn) { + Ok(args) => args, + Err(err) => return err.into_compile_error().into(), + }; let inline_wit = match build_script_wit(Span::call_site(), config.export_interface) { Ok(wit) => wit, @@ -73,14 +58,10 @@ pub(crate) fn expand( let inline_literal = Literal::string(&inline_wit); let struct_ident = quote::format_ident!("Struct"); - let fn_inputs = &input_fn.sig.inputs; let fn_output = &input_fn.sig.output; - let call = if call_args.is_empty() { - quote! { #fn_ident() } - } else { - quote! { #fn_ident(#(#call_args),*) } - }; + // Build the call to the user's run function with all arguments + let call = build_run_call(fn_ident, &parsed_args); let export_path: syn::Path = match syn::parse_str(config.guest_trait_path) { Ok(path) => path, @@ -96,6 +77,12 @@ pub(crate) fn expand( let runtime_boilerplate = runtime_boilerplate(); + // Generate the trait's fn signature (only includes the first arg if present) + let trait_fn_inputs = &parsed_args.trait_fn_inputs; + + // Generate instantiation statements for injected wrapper structs + let instantiations = &parsed_args.instantiations; + let expanded = quote! { #runtime_boilerplate @@ -108,7 +95,8 @@ pub(crate) fn expand( pub struct #struct_ident; impl #export_path for #struct_ident { - fn run(#fn_inputs) #fn_output { + fn run(#trait_fn_inputs) #fn_output { + #(#instantiations)* #call; } } @@ -117,6 +105,85 @@ pub(crate) fn expand( expanded.into() } +/// Parsed function arguments separated into trait-required and injected arguments. +struct ParsedFnArgs { + /// The first argument (if any) that matches the trait signature (e.g., `arg: Word`). + /// This is used in the generated trait impl signature. + trait_fn_inputs: proc_macro2::TokenStream, + /// Instantiation statements for injected wrapper structs. + /// Each statement is like `let wallet = Type::default();` + instantiations: Vec, + /// All argument identifiers in order, for calling the user's function. + all_arg_idents: Vec, +} + +/// Parses function arguments, separating the first trait-required argument from +/// additional "injected" arguments whose types will be instantiated via `Default`. +fn parse_fn_args(input_fn: &ItemFn) -> syn::Result { + let mut trait_fn_inputs = proc_macro2::TokenStream::new(); + let mut instantiations = Vec::new(); + let mut all_arg_idents = Vec::new(); + + for (idx, arg) in input_fn.sig.inputs.iter().enumerate() { + match arg { + FnArg::Typed(pat_type) => { + let ident = match pat_type.pat.as_ref() { + Pat::Ident(PatIdent { ident, .. }) => ident.clone(), + other => { + return Err(syn::Error::new( + other.span(), + "function arguments must be simple identifiers", + )); + } + }; + + all_arg_idents.push(ident.clone()); + + if idx == 0 { + // First argument is the trait-required argument (e.g., `arg: Word`) + trait_fn_inputs = quote! { #pat_type }; + } else { + // Additional arguments are injected wrapper structs + let ty = &pat_type.ty; + let instantiation = build_instantiation(&ident, ty); + instantiations.push(instantiation); + } + } + FnArg::Receiver(receiver) => { + return Err(syn::Error::new(receiver.span(), "unexpected receiver argument")); + } + } + } + + Ok(ParsedFnArgs { + trait_fn_inputs, + instantiations, + all_arg_idents, + }) +} + +/// Builds an instantiation statement for an injected wrapper struct. +/// +/// The type path is converted to use `crate::bindings::` prefix to reference +/// the generated bindings module. +fn build_instantiation(ident: &syn::Ident, ty: &Type) -> proc_macro2::TokenStream { + // For now, we just call Default::default() on the type as-is. + // The user is expected to use the full path or import the type. + quote! { + let #ident = <#ty as ::core::default::Default>::default(); + } +} + +/// Builds the call expression to the user's run function with all arguments. +fn build_run_call(fn_ident: &syn::Ident, parsed_args: &ParsedFnArgs) -> proc_macro2::TokenStream { + let args = &parsed_args.all_arg_idents; + if args.is_empty() { + quote! { #fn_ident() } + } else { + quote! { #fn_ident(#(#args),*) } + } +} + fn build_script_wit( error_span: Span, export_interface: &'static str, From 551c97f7438188bfdb0c57ddbf50f7e4f656eb1a Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 27 Nov 2025 09:23:11 +0200 Subject: [PATCH 35/70] refactor: assume the `run` signature is known and expect exactly one generated `struct` to be the second parameter. --- sdk/base-macros/src/script.rs | 131 +++++++++++----------------------- 1 file changed, 41 insertions(+), 90 deletions(-) diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index ac1d81abe..7cfbcf658 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -2,7 +2,7 @@ use std::{env, fs, path::Path}; use proc_macro2::{Literal, Span}; use quote::quote; -use syn::{parse_macro_input, spanned::Spanned, FnArg, ItemFn, Pat, PatIdent, Type}; +use syn::{parse_macro_input, spanned::Spanned, FnArg, ItemFn, Pat, PatIdent}; use toml::Value; use crate::{boilerplate::runtime_boilerplate, util::generated_wit_folder_at}; @@ -44,10 +44,11 @@ pub(crate) fn expand( .into(); } - // Parse function arguments, separating the first trait-required argument from - // additional "injected" arguments that will be instantiated by the macro. - let parsed_args = match parse_fn_args(&input_fn) { - Ok(args) => args, + // Parse the optional second parameter (injected wrapper struct). + // The trait requires `fn run(arg: Word)`, so if the user declares a second parameter, + // it will be instantiated via `Default::default()` and passed to the user's function. + let injected_param = match parse_injected_param(&input_fn) { + Ok(param) => param, Err(err) => return err.into_compile_error().into(), }; @@ -58,11 +59,6 @@ pub(crate) fn expand( let inline_literal = Literal::string(&inline_wit); let struct_ident = quote::format_ident!("Struct"); - let fn_output = &input_fn.sig.output; - - // Build the call to the user's run function with all arguments - let call = build_run_call(fn_ident, &parsed_args); - let export_path: syn::Path = match syn::parse_str(config.guest_trait_path) { Ok(path) => path, Err(err) => { @@ -77,11 +73,14 @@ pub(crate) fn expand( let runtime_boilerplate = runtime_boilerplate(); - // Generate the trait's fn signature (only includes the first arg if present) - let trait_fn_inputs = &parsed_args.trait_fn_inputs; - - // Generate instantiation statements for injected wrapper structs - let instantiations = &parsed_args.instantiations; + // Generate the call to the user's function, with optional injected parameter + let (instantiation, call) = match &injected_param { + Some((ident, ty)) => ( + quote! { let #ident = <#ty as ::core::default::Default>::default(); }, + quote! { #fn_ident(arg, #ident) }, + ), + None => (quote! {}, quote! { #fn_ident(arg) }), + }; let expanded = quote! { #runtime_boilerplate @@ -95,8 +94,8 @@ pub(crate) fn expand( pub struct #struct_ident; impl #export_path for #struct_ident { - fn run(#trait_fn_inputs) #fn_output { - #(#instantiations)* + fn run(arg: ::miden::Word) { + #instantiation #call; } } @@ -105,82 +104,34 @@ pub(crate) fn expand( expanded.into() } -/// Parsed function arguments separated into trait-required and injected arguments. -struct ParsedFnArgs { - /// The first argument (if any) that matches the trait signature (e.g., `arg: Word`). - /// This is used in the generated trait impl signature. - trait_fn_inputs: proc_macro2::TokenStream, - /// Instantiation statements for injected wrapper structs. - /// Each statement is like `let wallet = Type::default();` - instantiations: Vec, - /// All argument identifiers in order, for calling the user's function. - all_arg_idents: Vec, -} +/// Parses the optional injected parameter from the user's `fn run` signature. +/// +/// The trait requires `fn run(arg: Word)`. If the user declares a second parameter, +/// it is treated as an "injected" wrapper struct that will be instantiated via +/// `Default::default()` and passed to the user's function. +/// +/// Returns `Some((ident, type))` if a second parameter exists, `None` otherwise. +fn parse_injected_param(input_fn: &ItemFn) -> syn::Result> { + let Some(second_arg) = input_fn.sig.inputs.iter().nth(1) else { + return Ok(None); + }; -/// Parses function arguments, separating the first trait-required argument from -/// additional "injected" arguments whose types will be instantiated via `Default`. -fn parse_fn_args(input_fn: &ItemFn) -> syn::Result { - let mut trait_fn_inputs = proc_macro2::TokenStream::new(); - let mut instantiations = Vec::new(); - let mut all_arg_idents = Vec::new(); - - for (idx, arg) in input_fn.sig.inputs.iter().enumerate() { - match arg { - FnArg::Typed(pat_type) => { - let ident = match pat_type.pat.as_ref() { - Pat::Ident(PatIdent { ident, .. }) => ident.clone(), - other => { - return Err(syn::Error::new( - other.span(), - "function arguments must be simple identifiers", - )); - } - }; - - all_arg_idents.push(ident.clone()); - - if idx == 0 { - // First argument is the trait-required argument (e.g., `arg: Word`) - trait_fn_inputs = quote! { #pat_type }; - } else { - // Additional arguments are injected wrapper structs - let ty = &pat_type.ty; - let instantiation = build_instantiation(&ident, ty); - instantiations.push(instantiation); + match second_arg { + FnArg::Typed(pat_type) => { + let ident = match pat_type.pat.as_ref() { + Pat::Ident(PatIdent { ident, .. }) => ident.clone(), + other => { + return Err(syn::Error::new( + other.span(), + "function arguments must be simple identifiers", + )); } - } - FnArg::Receiver(receiver) => { - return Err(syn::Error::new(receiver.span(), "unexpected receiver argument")); - } + }; + Ok(Some((ident, (*pat_type.ty).clone()))) + } + FnArg::Receiver(receiver) => { + Err(syn::Error::new(receiver.span(), "unexpected receiver argument")) } - } - - Ok(ParsedFnArgs { - trait_fn_inputs, - instantiations, - all_arg_idents, - }) -} - -/// Builds an instantiation statement for an injected wrapper struct. -/// -/// The type path is converted to use `crate::bindings::` prefix to reference -/// the generated bindings module. -fn build_instantiation(ident: &syn::Ident, ty: &Type) -> proc_macro2::TokenStream { - // For now, we just call Default::default() on the type as-is. - // The user is expected to use the full path or import the type. - quote! { - let #ident = <#ty as ::core::default::Default>::default(); - } -} - -/// Builds the call expression to the user's run function with all arguments. -fn build_run_call(fn_ident: &syn::Ident, parsed_args: &ParsedFnArgs) -> proc_macro2::TokenStream { - let args = &parsed_args.all_arg_idents; - if args.is_empty() { - quote! { #fn_ident() } - } else { - quote! { #fn_ident(#(#args),*) } } } From faebb864f94f7757581d784d5ca66429776229d6 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 27 Nov 2025 13:00:41 +0200 Subject: [PATCH 36/70] refactor: extract `manifest_paths` module into a separate file --- sdk/base-macros/src/generate.rs | 302 +------------------------- sdk/base-macros/src/lib.rs | 1 + sdk/base-macros/src/manifest_paths.rs | 300 +++++++++++++++++++++++++ sdk/base-macros/src/types.rs | 2 +- 4 files changed, 304 insertions(+), 301 deletions(-) create mode 100644 sdk/base-macros/src/manifest_paths.rs diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 7ca2cc890..c791826fe 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -1,8 +1,4 @@ -use std::{ - env, fs, - io::ErrorKind, - path::{Path, PathBuf}, -}; +use std::{env, fs, path::PathBuf}; use heck::ToUpperCamelCase; use proc_macro2::{Span, TokenStream as TokenStream2}; @@ -17,10 +13,7 @@ use syn::{ use wit_bindgen_core::wit_parser::{PackageId, Resolve, UnresolvedPackageGroup}; use wit_bindgen_rust::{Opts, WithOption}; -/// File name for the embedded Miden SDK WIT . -const SDK_WIT_FILE_NAME: &str = "miden.wit"; -/// Embedded Miden SDK WIT source. -pub(crate) const SDK_WIT_SOURCE: &str = include_str!("../wit/miden.wit"); +use crate::manifest_paths; #[derive(Default)] struct GenerateArgs { @@ -509,297 +502,6 @@ fn format_module_path(path: &[syn::Ident]) -> String { path.iter().map(|ident| ident.to_string()).collect::>().join("::") } -mod manifest_paths { - use toml::Value; - - use super::*; - use crate::util::bundled_wit_folder; - - /// WIT metadata extracted from the consuming crate. - pub struct ResolvedWit { - pub paths: Vec, - pub world: Option, - } - - #[derive(Default)] - pub struct ResolveOptions { - pub allow_missing_local_wit: bool, - } - - /// Collects WIT search paths and the target world from `Cargo.toml` + local files. - pub fn resolve_wit_paths(options: ResolveOptions) -> Result { - let manifest_dir = env::var("CARGO_MANIFEST_DIR").map_err(|err| { - Error::new(Span::call_site(), format!("failed to read CARGO_MANIFEST_DIR: {err}")) - })?; - let manifest_path = Path::new(&manifest_dir).join("Cargo.toml"); - - let manifest_content = fs::read_to_string(&manifest_path).map_err(|err| { - Error::new( - Span::call_site(), - format!("failed to read manifest '{}': {err}", manifest_path.display()), - ) - })?; - - let manifest: Value = manifest_content.parse().map_err(|err| { - Error::new( - Span::call_site(), - format!("failed to parse manifest '{}': {err}", manifest_path.display()), - ) - })?; - - let canonical_prelude_dir = ensure_sdk_wit()?; - - let mut resolved = Vec::new(); - - let prelude_dir = canonical_prelude_dir - .to_str() - .ok_or_else(|| { - Error::new( - Span::call_site(), - format!("path '{}' contains invalid UTF-8", canonical_prelude_dir.display()), - ) - })? - .to_owned(); - - resolved.push(prelude_dir); - - if let Some(dependencies) = manifest - .get("package") - .and_then(Value::as_table) - .and_then(|package| package.get("metadata")) - .and_then(Value::as_table) - .and_then(|metadata| metadata.get("component")) - .and_then(Value::as_table) - .and_then(|component| component.get("target")) - .and_then(Value::as_table) - .and_then(|target| target.get("dependencies")) - .and_then(Value::as_table) - { - for (name, dependency) in dependencies.iter() { - let table = dependency.as_table().ok_or_else(|| { - Error::new( - Span::call_site(), - format!( - "dependency '{name}' under \ - [package.metadata.component.target.dependencies] must be a table" - ), - ) - })?; - - let path_value = table.get("path").and_then(Value::as_str).ok_or_else(|| { - Error::new( - Span::call_site(), - format!("dependency '{name}' is missing a 'path' entry"), - ) - })?; - - let raw_path = PathBuf::from(path_value); - let absolute = if raw_path.is_absolute() { - raw_path - } else { - Path::new(&manifest_dir).join(&raw_path) - }; - - let canonical = fs::canonicalize(&absolute).unwrap_or_else(|_| absolute.clone()); - - let metadata = fs::metadata(&canonical).map_err(|err| { - Error::new( - Span::call_site(), - format!( - "failed to read metadata for dependency '{name}' path '{}': {err}", - canonical.display() - ), - ) - })?; - - let search_path = if metadata.is_dir() { - canonical - } else if let Some(parent) = canonical.parent() { - parent.to_path_buf() - } else { - return Err(Error::new( - Span::call_site(), - format!( - "dependency '{name}' path '{}' does not have a parent directory", - canonical.display() - ), - )); - }; - - let path_str = search_path.to_str().ok_or_else(|| { - Error::new( - Span::call_site(), - format!("dependency '{name}' path contains invalid UTF-8"), - ) - })?; - - if !resolved.iter().any(|existing| existing == path_str) { - resolved.push(path_str.to_owned()); - } - } - } - - let local_wit_root = Path::new(&manifest_dir).join("wit"); - let mut world = None; - - if local_wit_root.exists() && !options.allow_missing_local_wit { - let local_root = fs::canonicalize(&local_wit_root).unwrap_or(local_wit_root); - let local_root_str = local_root.to_str().ok_or_else(|| { - Error::new( - Span::call_site(), - format!("path '{}' contains invalid UTF-8", local_root.display()), - ) - })?; - if !resolved.iter().any(|existing| existing == local_root_str) { - resolved.push(local_root_str.to_owned()); - } - world = detect_world_name(&local_root)?; - } - - Ok(ResolvedWit { - paths: resolved, - world, - }) - } - - /// Ensures the embedded Miden SDK WIT is materialized in the project's folder. - fn ensure_sdk_wit() -> Result { - let autogenerated_wit_folder = bundled_wit_folder()?; - - let sdk_wit_path = autogenerated_wit_folder.join(super::SDK_WIT_FILE_NAME); - let sdk_version: &str = env!("CARGO_PKG_VERSION"); - let expected_source = format!( - "/// NOTE: This file is auto-generated from the Miden SDK.\n/// Version: \ - v{sdk_version}\n/// Any manual edits will be overwritten.\n\n{SDK_WIT_SOURCE}" - ); - let should_write_wit = match fs::read_to_string(&sdk_wit_path) { - Ok(existing) => existing != expected_source, - Err(err) if err.kind() == ErrorKind::NotFound => true, - Err(err) => { - return Err(Error::new( - Span::call_site(), - format!("failed to read '{}': {err}", sdk_wit_path.display()), - )); - } - }; - - if should_write_wit { - fs::write(&sdk_wit_path, expected_source).map_err(|err| { - Error::new( - Span::call_site(), - format!("failed to write '{}': {err}", sdk_wit_path.display()), - ) - })?; - } - - Ok(fs::canonicalize(&autogenerated_wit_folder).unwrap_or(autogenerated_wit_folder)) - } - - /// Scans the component's `wit` directory to find the default world. - fn detect_world_name(wit_root: &Path) -> Result, Error> { - let mut entries = fs::read_dir(wit_root) - .map_err(|err| { - Error::new( - Span::call_site(), - format!("failed to read '{}': {err}", wit_root.display()), - ) - })? - .collect::, _>>() - .map_err(|err| { - Error::new( - Span::call_site(), - format!("failed to iterate '{}': {err}", wit_root.display()), - ) - })?; - entries.sort_by_key(|entry| entry.file_name()); - - for entry in entries { - let path = entry.path(); - if path.file_name().is_some_and(|name| name == "deps") { - continue; - } - if path.is_dir() { - continue; - } - if path.extension().and_then(|ext| ext.to_str()) != Some("wit") { - continue; - } - - if let Some((package, world)) = parse_package_and_world(&path)? { - return Ok(Some(format!("{package}/{world}"))); - } - } - - Ok(None) - } - - /// Parses a WIT source file for its package declaration and first world definition. - fn parse_package_and_world(path: &Path) -> Result, Error> { - let contents = fs::read_to_string(path).map_err(|err| { - Error::new( - Span::call_site(), - format!("failed to read WIT file '{}': {err}", path.display()), - ) - })?; - - let package = extract_package_name(&contents); - let world = extract_world_name(&contents); - - match (package, world) { - (Some(package), Some(world)) => Ok(Some((package, world))), - _ => Ok(None), - } - } - - /// Returns the package identifier from a WIT source string, if present. - fn extract_package_name(contents: &str) -> Option { - for line in contents.lines() { - let trimmed = strip_comment(line).trim_start(); - if let Some(rest) = trimmed.strip_prefix("package ") { - let mut token = rest.trim(); - if let Some(idx) = token.find(';') { - token = &token[..idx]; - } - let mut name = token.trim(); - if let Some(idx) = name.find('@') { - name = &name[..idx]; - } - return Some(name.trim().to_string()); - } - } - None - } - - /// Returns the first world identifier from a WIT source string, if present. - pub(super) fn extract_world_name(contents: &str) -> Option { - for line in contents.lines() { - let trimmed = strip_comment(line).trim_start(); - if let Some(rest) = trimmed.strip_prefix("world ") { - let mut name = String::new(); - for ch in rest.trim().chars() { - if ch.is_alphanumeric() || ch == '-' || ch == '_' { - name.push(ch); - } else { - break; - } - } - if !name.is_empty() { - return Some(name); - } - } - } - None - } - - /// Strips line comments starting with `//` from the provided source line. - fn strip_comment(line: &str) -> &str { - match line.split_once("//") { - Some((before, _)) => before, - None => line, - } - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/sdk/base-macros/src/lib.rs b/sdk/base-macros/src/lib.rs index a93e60893..c84b78118 100644 --- a/sdk/base-macros/src/lib.rs +++ b/sdk/base-macros/src/lib.rs @@ -55,6 +55,7 @@ mod boilerplate; mod component_macro; mod export_type; mod generate; +mod manifest_paths; mod script; mod types; mod util; diff --git a/sdk/base-macros/src/manifest_paths.rs b/sdk/base-macros/src/manifest_paths.rs new file mode 100644 index 000000000..a92861316 --- /dev/null +++ b/sdk/base-macros/src/manifest_paths.rs @@ -0,0 +1,300 @@ +//! Utilities for resolving WIT paths from Cargo.toml manifest metadata. + +use std::{ + env, fs, + io::ErrorKind, + path::{Path, PathBuf}, +}; + +use proc_macro2::Span; +use syn::Error; +use toml::Value; + +use crate::util::bundled_wit_folder; + +/// File name for the embedded Miden SDK WIT. +const SDK_WIT_FILE_NAME: &str = "miden.wit"; + +/// Embedded Miden SDK WIT source. +pub(crate) const SDK_WIT_SOURCE: &str = include_str!("../wit/miden.wit"); + +/// WIT metadata extracted from the consuming crate. +pub(crate) struct ResolvedWit { + pub paths: Vec, + pub world: Option, +} + +#[derive(Default)] +pub(crate) struct ResolveOptions { + pub allow_missing_local_wit: bool, +} + +/// Collects WIT search paths and the target world from `Cargo.toml` + local files. +pub(crate) fn resolve_wit_paths(options: ResolveOptions) -> Result { + let manifest_dir = env::var("CARGO_MANIFEST_DIR").map_err(|err| { + Error::new(Span::call_site(), format!("failed to read CARGO_MANIFEST_DIR: {err}")) + })?; + let manifest_path = Path::new(&manifest_dir).join("Cargo.toml"); + + let manifest_content = fs::read_to_string(&manifest_path).map_err(|err| { + Error::new( + Span::call_site(), + format!("failed to read manifest '{}': {err}", manifest_path.display()), + ) + })?; + + let manifest: Value = manifest_content.parse().map_err(|err| { + Error::new( + Span::call_site(), + format!("failed to parse manifest '{}': {err}", manifest_path.display()), + ) + })?; + + let canonical_prelude_dir = ensure_sdk_wit()?; + + let mut resolved = Vec::new(); + + let prelude_dir = canonical_prelude_dir + .to_str() + .ok_or_else(|| { + Error::new( + Span::call_site(), + format!("path '{}' contains invalid UTF-8", canonical_prelude_dir.display()), + ) + })? + .to_owned(); + + resolved.push(prelude_dir); + + if let Some(dependencies) = manifest + .get("package") + .and_then(Value::as_table) + .and_then(|package| package.get("metadata")) + .and_then(Value::as_table) + .and_then(|metadata| metadata.get("component")) + .and_then(Value::as_table) + .and_then(|component| component.get("target")) + .and_then(Value::as_table) + .and_then(|target| target.get("dependencies")) + .and_then(Value::as_table) + { + for (name, dependency) in dependencies.iter() { + let table = dependency.as_table().ok_or_else(|| { + Error::new( + Span::call_site(), + format!( + "dependency '{name}' under \ + [package.metadata.component.target.dependencies] must be a table" + ), + ) + })?; + + let path_value = table.get("path").and_then(Value::as_str).ok_or_else(|| { + Error::new( + Span::call_site(), + format!("dependency '{name}' is missing a 'path' entry"), + ) + })?; + + let raw_path = PathBuf::from(path_value); + let absolute = if raw_path.is_absolute() { + raw_path + } else { + Path::new(&manifest_dir).join(&raw_path) + }; + + let canonical = fs::canonicalize(&absolute).unwrap_or_else(|_| absolute.clone()); + + let metadata = fs::metadata(&canonical).map_err(|err| { + Error::new( + Span::call_site(), + format!( + "failed to read metadata for dependency '{name}' path '{}': {err}", + canonical.display() + ), + ) + })?; + + let search_path = if metadata.is_dir() { + canonical + } else if let Some(parent) = canonical.parent() { + parent.to_path_buf() + } else { + return Err(Error::new( + Span::call_site(), + format!( + "dependency '{name}' path '{}' does not have a parent directory", + canonical.display() + ), + )); + }; + + let path_str = search_path.to_str().ok_or_else(|| { + Error::new( + Span::call_site(), + format!("dependency '{name}' path contains invalid UTF-8"), + ) + })?; + + if !resolved.iter().any(|existing| existing == path_str) { + resolved.push(path_str.to_owned()); + } + } + } + + let local_wit_root = Path::new(&manifest_dir).join("wit"); + let mut world = None; + + if local_wit_root.exists() && !options.allow_missing_local_wit { + let local_root = fs::canonicalize(&local_wit_root).unwrap_or(local_wit_root); + let local_root_str = local_root.to_str().ok_or_else(|| { + Error::new( + Span::call_site(), + format!("path '{}' contains invalid UTF-8", local_root.display()), + ) + })?; + if !resolved.iter().any(|existing| existing == local_root_str) { + resolved.push(local_root_str.to_owned()); + } + world = detect_world_name(&local_root)?; + } + + Ok(ResolvedWit { + paths: resolved, + world, + }) +} + +/// Ensures the embedded Miden SDK WIT is materialized in the project's folder. +fn ensure_sdk_wit() -> Result { + let autogenerated_wit_folder = bundled_wit_folder()?; + + let sdk_wit_path = autogenerated_wit_folder.join(SDK_WIT_FILE_NAME); + let sdk_version: &str = env!("CARGO_PKG_VERSION"); + let expected_source = format!( + "/// NOTE: This file is auto-generated from the Miden SDK.\n/// Version: \ + v{sdk_version}\n/// Any manual edits will be overwritten.\n\n{SDK_WIT_SOURCE}" + ); + let should_write_wit = match fs::read_to_string(&sdk_wit_path) { + Ok(existing) => existing != expected_source, + Err(err) if err.kind() == ErrorKind::NotFound => true, + Err(err) => { + return Err(Error::new( + Span::call_site(), + format!("failed to read '{}': {err}", sdk_wit_path.display()), + )); + } + }; + + if should_write_wit { + fs::write(&sdk_wit_path, expected_source).map_err(|err| { + Error::new( + Span::call_site(), + format!("failed to write '{}': {err}", sdk_wit_path.display()), + ) + })?; + } + + Ok(fs::canonicalize(&autogenerated_wit_folder).unwrap_or(autogenerated_wit_folder)) +} + +/// Scans the component's `wit` directory to find the default world. +fn detect_world_name(wit_root: &Path) -> Result, Error> { + let mut entries = fs::read_dir(wit_root) + .map_err(|err| { + Error::new(Span::call_site(), format!("failed to read '{}': {err}", wit_root.display())) + })? + .collect::, _>>() + .map_err(|err| { + Error::new( + Span::call_site(), + format!("failed to iterate '{}': {err}", wit_root.display()), + ) + })?; + entries.sort_by_key(|entry| entry.file_name()); + + for entry in entries { + let path = entry.path(); + if path.file_name().is_some_and(|name| name == "deps") { + continue; + } + if path.is_dir() { + continue; + } + if path.extension().and_then(|ext| ext.to_str()) != Some("wit") { + continue; + } + + if let Some((package, world)) = parse_package_and_world(&path)? { + return Ok(Some(format!("{package}/{world}"))); + } + } + + Ok(None) +} + +/// Parses a WIT source file for its package declaration and first world definition. +fn parse_package_and_world(path: &Path) -> Result, Error> { + let contents = fs::read_to_string(path).map_err(|err| { + Error::new( + Span::call_site(), + format!("failed to read WIT file '{}': {err}", path.display()), + ) + })?; + + let package = extract_package_name(&contents); + let world = extract_world_name(&contents); + + match (package, world) { + (Some(package), Some(world)) => Ok(Some((package, world))), + _ => Ok(None), + } +} + +/// Returns the package identifier from a WIT source string, if present. +fn extract_package_name(contents: &str) -> Option { + for line in contents.lines() { + let trimmed = strip_comment(line).trim_start(); + if let Some(rest) = trimmed.strip_prefix("package ") { + let mut token = rest.trim(); + if let Some(idx) = token.find(';') { + token = &token[..idx]; + } + let mut name = token.trim(); + if let Some(idx) = name.find('@') { + name = &name[..idx]; + } + return Some(name.trim().to_string()); + } + } + None +} + +/// Returns the first world identifier from a WIT source string, if present. +pub(crate) fn extract_world_name(contents: &str) -> Option { + for line in contents.lines() { + let trimmed = strip_comment(line).trim_start(); + if let Some(rest) = trimmed.strip_prefix("world ") { + let mut name = String::new(); + for ch in rest.trim().chars() { + if ch.is_alphanumeric() || ch == '-' || ch == '_' { + name.push(ch); + } else { + break; + } + } + if !name.is_empty() { + return Some(name); + } + } + } + None +} + +/// Strips line comments starting with `//` from the provided source line. +fn strip_comment(line: &str) -> &str { + match line.split_once("//") { + Some((before, _)) => before, + None => line, + } +} diff --git a/sdk/base-macros/src/types.rs b/sdk/base-macros/src/types.rs index ea01d012f..9951c56cf 100644 --- a/sdk/base-macros/src/types.rs +++ b/sdk/base-macros/src/types.rs @@ -9,7 +9,7 @@ use heck::ToKebabCase; use proc_macro2::Span; use syn::{spanned::Spanned, ItemStruct, Type}; -use crate::generate::SDK_WIT_SOURCE; +use crate::manifest_paths::SDK_WIT_SOURCE; #[derive(Clone, Debug)] pub(crate) struct TypeRef { From 49ecb59b7f0076ea86629790b84bf313f28c4795 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 27 Nov 2025 15:27:01 +0200 Subject: [PATCH 37/70] refactor: move `struct` generation up and call it `bindings::Account` --- examples/basic-wallet-tx-script/src/lib.rs | 4 +- examples/p2id-note/src/lib.rs | 4 +- sdk/base-macros/src/generate.rs | 307 ++++++++++++--------- 3 files changed, 182 insertions(+), 133 deletions(-) diff --git a/examples/basic-wallet-tx-script/src/lib.rs b/examples/basic-wallet-tx-script/src/lib.rs index 220644b10..d33761cef 100644 --- a/examples/basic-wallet-tx-script/src/lib.rs +++ b/examples/basic-wallet-tx-script/src/lib.rs @@ -10,7 +10,7 @@ use miden::{intrinsics::advice::adv_push_mapvaln, *}; -use crate::bindings::miden::basic_wallet::basic_wallet::BasicWallet; +use crate::bindings::Account; // Input layout constants const TAG_INDEX: usize = 0; @@ -23,7 +23,7 @@ const ASSET_START: usize = 8; const ASSET_END: usize = 12; #[tx_script] -fn run(arg: Word, account: BasicWallet) { +fn run(arg: Word, account: Account) { let num_felts = adv_push_mapvaln(arg.clone()); let num_felts_u64 = num_felts.as_u64(); assert_eq(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 8af786700..14aecef8a 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -9,10 +9,10 @@ use miden::*; -use crate::bindings::miden::basic_wallet::basic_wallet::BasicWallet; +use crate::bindings::Account; #[note_script] -fn run(_arg: Word, account: BasicWallet) { +fn run(_arg: Word, account: Account) { let inputs = active_note::get_inputs(); let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index c791826fe..5841241ce 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -1,14 +1,14 @@ use std::{env, fs, path::PathBuf}; -use heck::ToUpperCamelCase; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::{quote, ToTokens}; use syn::{ parse::{Parse, ParseStream}, parse_quote, spanned::Spanned, + visit_mut::VisitMut, Attribute, Error, File, FnArg, ImplItem, ImplItemFn, Item, ItemFn, ItemImpl, ItemStruct, - LitStr, Pat, ReturnType, Token, + LitStr, Pat, ReturnType, Token, TypePath, }; use wit_bindgen_core::wit_parser::{PackageId, Resolve, UnresolvedPackageGroup}; use wit_bindgen_rust::{Opts, WithOption}; @@ -215,13 +215,33 @@ fn generate_bindings( /// Post-processes wit-bindgen output to inject wrapper structs for imported interfaces. /// -/// This transforms the raw bindings by walking all modules and injecting a wrapper struct -/// with methods that delegate to the generated free functions. This provides a more -/// ergonomic API (e.g., `BasicWallet::default().receive_asset(asset)` instead of -/// `basic_wallet::receive_asset(asset)`). +/// This transforms the raw bindings by walking all modules and injecting an `Account` wrapper +/// struct at the bindings root level. The struct has methods that delegate to the generated +/// free functions in leaf modules. This provides a more ergonomic API +/// (e.g., `Account::default().receive_asset(asset)` instead of +/// `miden::basic_wallet::basic_wallet::receive_asset(asset)`). fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result { let mut file: File = syn::parse2(tokens)?; - transform_modules(&mut file.items, &mut Vec::new())?; + let mut collected_methods = Vec::new(); + collect_wrapper_methods(&file.items, &mut Vec::new(), &mut collected_methods)?; + + if !collected_methods.is_empty() { + let struct_ident = syn::Ident::new("Account", Span::call_site()); + let struct_item: ItemStruct = parse_quote! { + /// Wrapper struct providing methods that delegate to imported interface functions. + #[derive(Clone, Copy, Default)] + pub struct #struct_ident; + }; + + let mut impl_item: ItemImpl = parse_quote! { + impl #struct_ident {} + }; + impl_item.items.extend(collected_methods.into_iter().map(ImplItem::Fn)); + + file.items.push(Item::Struct(struct_item)); + file.items.push(Item::Impl(impl_item)); + } + Ok(file.into_token_stream()) } @@ -311,16 +331,21 @@ fn push_path_entry(opts: &mut Opts, key: &str, value: &str) { opts.with.push((key.to_string(), WithOption::Path(value.to_string()))); } -/// Recursively walks all modules and injects wrapper structs where appropriate. +/// Recursively walks all modules and collects wrapper methods from leaf modules. /// -/// The `path` parameter tracks the current module path for naming and call generation. -fn transform_modules(items: &mut [Item], path: &mut Vec) -> syn::Result<()> { - for item in items.iter_mut() { +/// The `path` parameter tracks the current module path for generating correct call paths. +/// Collected methods are appended to `methods_out` and will be placed in the root `Account` struct. +fn collect_wrapper_methods( + items: &[Item], + path: &mut Vec, + methods_out: &mut Vec, +) -> syn::Result<()> { + for item in items.iter() { if let Item::Mod(module) = item { path.push(module.ident.clone()); - if let Some((_, ref mut content)) = module.content { - transform_modules(content, path)?; - maybe_inject_struct_wrapper(content, path)?; + if let Some((_, ref content)) = module.content { + collect_wrapper_methods(content, path, methods_out)?; + collect_methods_from_module(content, path, methods_out)?; } path.pop(); } @@ -329,76 +354,46 @@ fn transform_modules(items: &mut [Item], path: &mut Vec) -> syn::Res Ok(()) } -/// Injects a wrapper struct and impl block for public functions in a leaf module. +/// Collects wrapper methods from a leaf module's public functions. /// -/// A leaf module is one that contains no nested modules. Only leaf modules get wrapper -/// structs generated, as non-leaf modules typically represent namespace hierarchy rather -/// than concrete interfaces. -/// -/// Note: We need `&mut Vec` here (not `&mut [Item]`) because we push new items -/// (the struct and impl block) to the vector. -fn maybe_inject_struct_wrapper(items: &mut Vec, path: &[syn::Ident]) -> syn::Result<()> { +/// A leaf module is one that contains no nested modules. Only leaf modules contribute +/// methods, as non-leaf modules typically represent namespace hierarchy rather than +/// concrete interfaces. +fn collect_methods_from_module( + items: &[Item], + path: &[syn::Ident], + methods_out: &mut Vec, +) -> syn::Result<()> { if !should_generate_struct(path, items) { return Ok(()); } - let functions: Vec = items + let functions: Vec<&ItemFn> = items .iter() .filter_map(|item| match item { - Item::Fn(func) if is_target_function(func) => Some(func.clone()), + Item::Fn(func) if is_target_function(func) => Some(func), _ => None, }) .collect(); - if functions.is_empty() { - return Ok(()); - } - - let module_ident = - path.last().ok_or_else(|| Error::new(Span::call_site(), "empty module path"))?; - let struct_ident = - syn::Ident::new(&module_ident.to_string().to_upper_camel_case(), module_ident.span()); - - if items - .iter() - .any(|item| matches!(item, Item::Struct(existing) if existing.ident == struct_ident)) - { - return Ok(()); - } - - let struct_doc = - format!("Wrapper for functions defined in module `{}`.", format_module_path(path)); - let struct_item: ItemStruct = parse_quote! { - #[doc = #struct_doc] - #[derive(Clone, Copy, Default)] - pub struct #struct_ident; - }; - - let mut methods = Vec::new(); for func in functions { - methods.push(build_wrapper_method(&func, path)?); - } - - if methods.is_empty() { - return Ok(()); + methods_out.push(build_wrapper_method(func, path)?); } - let mut impl_item: ItemImpl = parse_quote! { - impl #struct_ident {} - }; - impl_item.items.extend(methods.into_iter().map(ImplItem::Fn)); - - items.push(Item::Struct(struct_item)); - items.push(Item::Impl(impl_item)); - Ok(()) } /// Builds a wrapper method that delegates to the original free function. +/// +/// Type paths in the signature are qualified with the module path prefix so they +/// resolve correctly when the method is placed at the bindings root level. fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Result { let mut sig = func.sig.clone(); sig.inputs.insert(0, parse_quote!(&self)); + // Qualify type paths in the signature so they resolve from the bindings root + qualify_signature_types(&mut sig, module_path); + let arg_idents = collect_arg_idents(func)?; let call_expr = wrapper_call_tokens(module_path, &sig.ident, &arg_idents); @@ -422,6 +417,87 @@ fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Resul }) } +/// Qualifies type paths in a function signature with the module path prefix. +/// +/// This transforms simple type names (e.g., `StructA`) into fully qualified paths +/// (e.g., `miden::component::component::StructA`) so they resolve correctly when +/// the method is placed at the bindings root level. +fn qualify_signature_types(sig: &mut syn::Signature, module_path: &[syn::Ident]) { + struct TypeQualifier<'a> { + module_path: &'a [syn::Ident], + } + + impl VisitMut for TypeQualifier<'_> { + fn visit_type_path_mut(&mut self, type_path: &mut TypePath) { + // Only qualify paths that: + // 1. Don't already have a leading colon (not absolute like `::foo`) + // 2. Are simple single-segment paths (like `StructA`, not `foo::Bar`) + // 3. Don't start with common primitive/std type names + if type_path.qself.is_none() + && type_path.path.leading_colon.is_none() + && type_path.path.segments.len() == 1 + { + let first_segment = &type_path.path.segments[0].ident; + let name = first_segment.to_string(); + + // Skip primitive types and common std types + if is_primitive_or_std_type(&name) { + return; + } + + // Build the qualified path: module_path::TypeName + let mut new_segments = syn::punctuated::Punctuated::new(); + for ident in self.module_path { + new_segments.push(syn::PathSegment { + ident: ident.clone(), + arguments: syn::PathArguments::None, + }); + } + // Add the original type segment (preserving generics) + new_segments.push(type_path.path.segments[0].clone()); + + type_path.path.segments = new_segments; + } + + // Continue visiting nested types (e.g., generics) + syn::visit_mut::visit_type_path_mut(self, type_path); + } + } + + let mut qualifier = TypeQualifier { module_path }; + qualifier.visit_signature_mut(sig); +} + +/// Returns true if the name is a primitive type or common std type that shouldn't be qualified. +fn is_primitive_or_std_type(name: &str) -> bool { + matches!( + name, + "bool" + | "char" + | "str" + | "u8" + | "u16" + | "u32" + | "u64" + | "u128" + | "usize" + | "i8" + | "i16" + | "i32" + | "i64" + | "i128" + | "isize" + | "f32" + | "f64" + | "String" + | "Vec" + | "Option" + | "Result" + | "Box" + | "Self" + ) +} + /// Extracts argument identifiers from a function signature. /// /// Returns an error if the function contains a receiver (`self`) or uses @@ -634,7 +710,7 @@ mod tests { } #[test] - fn test_transform_modules_injects_struct() { + fn test_collect_wrapper_methods_from_leaf_module() { let src = r#" mod miden { mod basic_wallet { @@ -645,48 +721,21 @@ mod tests { } } "#; - let mut file = parse_file(src); - transform_modules(&mut file.items, &mut Vec::new()).unwrap(); + let file = parse_file(src); + let mut methods = Vec::new(); + collect_wrapper_methods(&file.items, &mut Vec::new(), &mut methods).unwrap(); - // Check that the innermost module now contains a struct and impl - let miden_mod = match &file.items[0] { - Item::Mod(m) => m, - _ => panic!("expected mod"), - }; - let basic_wallet_outer = match &miden_mod.content.as_ref().unwrap().1[0] { - Item::Mod(m) => m, - _ => panic!("expected mod"), - }; - let basic_wallet_inner = match &basic_wallet_outer.content.as_ref().unwrap().1[0] { - Item::Mod(m) => m, - _ => panic!("expected mod"), - }; - let inner_items = &basic_wallet_inner.content.as_ref().unwrap().1; - - // Should have: 2 functions + 1 struct + 1 impl = 4 items - assert_eq!(inner_items.len(), 4); - - // Check struct exists and has correct name - let struct_item = inner_items.iter().find_map(|item| match item { - Item::Struct(s) => Some(s), - _ => None, - }); - assert!(struct_item.is_some()); - assert_eq!(struct_item.unwrap().ident.to_string(), "BasicWallet"); + // Should have collected 2 methods from the leaf module + assert_eq!(methods.len(), 2); - // Check impl exists - let impl_item = inner_items.iter().find_map(|item| match item { - Item::Impl(i) => Some(i), - _ => None, - }); - assert!(impl_item.is_some()); - let impl_block = impl_item.unwrap(); - // Should have 2 methods - assert_eq!(impl_block.items.len(), 2); + // Check method names + let method_names: Vec<_> = methods.iter().map(|m| m.sig.ident.to_string()).collect(); + assert!(method_names.contains(&"receive_asset".to_string())); + assert!(method_names.contains(&"send_asset".to_string())); } #[test] - fn test_transform_modules_skips_exports() { + fn test_collect_wrapper_methods_skips_exports() { let src = r#" mod exports { mod my_component { @@ -694,48 +743,48 @@ mod tests { } } "#; - let mut file = parse_file(src); - transform_modules(&mut file.items, &mut Vec::new()).unwrap(); - - // exports module should not have any struct injected - let exports_mod = match &file.items[0] { - Item::Mod(m) => m, - _ => panic!("expected mod"), - }; - let my_component = match &exports_mod.content.as_ref().unwrap().1[0] { - Item::Mod(m) => m, - _ => panic!("expected mod"), - }; - let items = &my_component.content.as_ref().unwrap().1; + let file = parse_file(src); + let mut methods = Vec::new(); + collect_wrapper_methods(&file.items, &mut Vec::new(), &mut methods).unwrap(); - // Should only have the original function, no struct added - assert_eq!(items.len(), 1); - assert!(matches!(items[0], Item::Fn(_))); + // exports module should not contribute any methods + assert!(methods.is_empty()); } #[test] - fn test_transform_modules_skips_empty_modules() { + fn test_collect_wrapper_methods_skips_empty_modules() { let src = r#" mod miden { mod empty_module { } } "#; - let mut file = parse_file(src); - transform_modules(&mut file.items, &mut Vec::new()).unwrap(); + let file = parse_file(src); + let mut methods = Vec::new(); + collect_wrapper_methods(&file.items, &mut Vec::new(), &mut methods).unwrap(); - let miden_mod = match &file.items[0] { - Item::Mod(m) => m, - _ => panic!("expected mod"), - }; - let empty_module = match &miden_mod.content.as_ref().unwrap().1[0] { - Item::Mod(m) => m, - _ => panic!("expected mod"), + // No methods should be collected from empty module + assert!(methods.is_empty()); + } + + #[test] + fn test_qualify_signature_types() { + let func: ItemFn = syn::parse_quote! { + pub fn test_fn(a: StructA, b: u64) -> StructB {} }; - let items = &empty_module.content.as_ref().unwrap().1; + let path = vec![ + syn::Ident::new("miden", Span::call_site()), + syn::Ident::new("component", Span::call_site()), + ]; + let method = build_wrapper_method(&func, &path).unwrap(); - // Should remain empty - assert!(items.is_empty()); + // Check that the types are qualified + let sig_str = method.sig.to_token_stream().to_string(); + assert!(sig_str.contains("miden :: component :: StructA")); + assert!(sig_str.contains("miden :: component :: StructB")); + // Primitives should not be qualified + assert!(sig_str.contains("u64")); + assert!(!sig_str.contains("miden :: component :: u64")); } #[test] From 089612cbc0d6094e2fad73e5f804c0510953a8ab Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 27 Nov 2025 17:17:11 +0200 Subject: [PATCH 38/70] refactor: de-duplicate code, add comments, test --- sdk/base-macros/src/generate.rs | 140 +++++++++++++++++++++++++- sdk/base-macros/src/manifest_paths.rs | 16 +-- sdk/base-macros/src/script.rs | 16 ++- sdk/base-macros/src/util.rs | 10 ++ 4 files changed, 155 insertions(+), 27 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 5841241ce..3faca5787 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -245,14 +245,15 @@ fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result Ok(file.into_token_stream()) } -/// Result of loading WIT sources. +/// Result of loading and parsing WIT sources from file paths and optional inline content. struct LoadedWitSources { - /// The resolved WIT definitions. + /// The resolved WIT definitions containing all types, interfaces, and worlds. resolve: Resolve, - /// Package IDs to use for world selection. + /// Package IDs to use for world selection. When inline source is provided, this contains + /// only the inline package; otherwise it contains all packages from file paths. packages: Vec, - /// File paths that were read to include a dummy `include_bytes!` so rustc knows that we depend - /// on the contents of those files. + /// File paths that were read during WIT parsing. Used to generate dummy `include_bytes!` + /// calls so rustc knows to recompile when these files change. files_read: Vec, } @@ -820,4 +821,133 @@ mod tests { // Return type should be preserved assert!(matches!(method.sig.output, ReturnType::Type(_, _))); } + + #[test] + fn test_augment_generated_bindings_adds_account_struct() { + let src = r#" + mod miden { + mod basic_wallet { + mod basic_wallet { + pub fn receive_asset(asset: u64) {} + pub fn send_asset(to: u32, amount: u64) -> bool { true } + } + } + } + "#; + let tokens: TokenStream2 = src.parse().unwrap(); + let result = augment_generated_bindings(tokens).unwrap(); + let result_str = result.to_string(); + + // Should contain the Account struct + assert!(result_str.contains("struct Account")); + assert!(result_str.contains("impl Account")); + + // Should contain wrapper methods + assert!(result_str.contains("fn receive_asset")); + assert!(result_str.contains("fn send_asset")); + + // Methods should have &self parameter + assert!(result_str.contains("& self")); + } + + #[test] + fn test_augment_generated_bindings_empty_input() { + let src = ""; + let tokens: TokenStream2 = src.parse().unwrap(); + let result = augment_generated_bindings(tokens).unwrap(); + let result_str = result.to_string(); + + // Should not add Account struct when there are no methods + assert!(!result_str.contains("struct Account")); + } + + #[test] + fn test_augment_generated_bindings_exports_only() { + let src = r#" + mod exports { + mod my_component { + pub fn exported_fn() {} + } + } + "#; + let tokens: TokenStream2 = src.parse().unwrap(); + let result = augment_generated_bindings(tokens).unwrap(); + let result_str = result.to_string(); + + // Should not add Account struct for exports-only bindings + assert!(!result_str.contains("struct Account")); + } + + #[test] + fn test_augment_generated_bindings_preserves_original_modules() { + let src = r#" + mod miden { + mod wallet { + pub fn get_balance() -> u64 { 0 } + } + } + "#; + let tokens: TokenStream2 = src.parse().unwrap(); + let result = augment_generated_bindings(tokens).unwrap(); + let result_str = result.to_string(); + + // Original module structure should be preserved + assert!(result_str.contains("mod miden")); + assert!(result_str.contains("mod wallet")); + assert!(result_str.contains("fn get_balance")); + } + + #[test] + fn test_wrapper_call_tokens_generates_correct_path() { + let path = vec![ + syn::Ident::new("miden", Span::call_site()), + syn::Ident::new("basic_wallet", Span::call_site()), + ]; + let fn_ident = syn::Ident::new("receive_asset", Span::call_site()); + let args = vec![syn::Ident::new("asset", Span::call_site())]; + + let tokens = wrapper_call_tokens(&path, &fn_ident, &args); + let result = tokens.to_string(); + + assert!(result.contains("crate :: bindings :: miden :: basic_wallet :: receive_asset")); + assert!(result.contains("asset")); + } + + #[test] + fn test_parse_with_entry_generate() { + let input: TokenStream2 = quote! { "miden:foo/bar": generate }; + let parsed = syn::parse2::(quote! { with = { #input } }).unwrap(); + + assert_eq!(parsed.with_entries.len(), 1); + assert_eq!(parsed.with_entries[0].0, "miden:foo/bar"); + assert!(matches!(parsed.with_entries[0].1, WithOption::Generate)); + } + + #[test] + fn test_parse_with_entry_path() { + let input: TokenStream2 = quote! { "miden:foo/bar": ::my::custom::Type }; + let parsed = syn::parse2::(quote! { with = { #input } }).unwrap(); + + assert_eq!(parsed.with_entries.len(), 1); + assert_eq!(parsed.with_entries[0].0, "miden:foo/bar"); + match &parsed.with_entries[0].1 { + WithOption::Path(p) => assert_eq!(p, "::my::custom::Type"), + _ => panic!("expected Path variant"), + } + } + + #[test] + fn test_parse_multiple_with_entries() { + let parsed = syn::parse2::(quote! { + with = { + "miden:a/b": generate, + "miden:c/d": ::foo::Bar + } + }) + .unwrap(); + + assert_eq!(parsed.with_entries.len(), 2); + assert_eq!(parsed.with_entries[0].0, "miden:a/b"); + assert_eq!(parsed.with_entries[1].0, "miden:c/d"); + } } diff --git a/sdk/base-macros/src/manifest_paths.rs b/sdk/base-macros/src/manifest_paths.rs index a92861316..9850ff521 100644 --- a/sdk/base-macros/src/manifest_paths.rs +++ b/sdk/base-macros/src/manifest_paths.rs @@ -10,7 +10,7 @@ use proc_macro2::Span; use syn::Error; use toml::Value; -use crate::util::bundled_wit_folder; +use crate::util::{bundled_wit_folder, strip_line_comment}; /// File name for the embedded Miden SDK WIT. const SDK_WIT_FILE_NAME: &str = "miden.wit"; @@ -254,7 +254,7 @@ fn parse_package_and_world(path: &Path) -> Result, Erro /// Returns the package identifier from a WIT source string, if present. fn extract_package_name(contents: &str) -> Option { for line in contents.lines() { - let trimmed = strip_comment(line).trim_start(); + let trimmed = strip_line_comment(line).trim_start(); if let Some(rest) = trimmed.strip_prefix("package ") { let mut token = rest.trim(); if let Some(idx) = token.find(';') { @@ -270,10 +270,10 @@ fn extract_package_name(contents: &str) -> Option { None } -/// Returns the first world identifier from a WIT source string, if present. +/// Extracts the first world identifier from a WIT source string. pub(crate) fn extract_world_name(contents: &str) -> Option { for line in contents.lines() { - let trimmed = strip_comment(line).trim_start(); + let trimmed = strip_line_comment(line).trim_start(); if let Some(rest) = trimmed.strip_prefix("world ") { let mut name = String::new(); for ch in rest.trim().chars() { @@ -290,11 +290,3 @@ pub(crate) fn extract_world_name(contents: &str) -> Option { } None } - -/// Strips line comments starting with `//` from the provided source line. -fn strip_comment(line: &str) -> &str { - match line.split_once("//") { - Some((before, _)) => before, - None => line, - } -} diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index 7cfbcf658..d3b9b7230 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -5,7 +5,10 @@ use quote::quote; use syn::{parse_macro_input, spanned::Spanned, FnArg, ItemFn, Pat, PatIdent}; use toml::Value; -use crate::{boilerplate::runtime_boilerplate, util::generated_wit_folder_at}; +use crate::{ + boilerplate::runtime_boilerplate, + util::{generated_wit_folder_at, strip_line_comment}, +}; const SCRIPT_PACKAGE_VERSION: &str = "1.0.0"; @@ -359,7 +362,7 @@ fn parse_wit_file(path: &Path) -> Result, String> { fn extract_package_identifier(contents: &str) -> Option<(String, Option)> { for line in contents.lines() { - let trimmed = strip_comment(line).trim_start(); + let trimmed = strip_line_comment(line).trim_start(); if let Some(rest) = trimmed.strip_prefix("package ") { let token = rest.trim_end_matches(';').trim(); if let Some((name, version)) = token.split_once('@') { @@ -375,7 +378,7 @@ fn extract_world_exports(contents: &str) -> Vec { let mut exports = Vec::new(); for line in contents.lines() { - let trimmed = strip_comment(line).trim(); + let trimmed = strip_line_comment(line).trim(); if let Some(rest) = trimmed.strip_prefix("export ") { let rest = rest.trim_end_matches(';').trim(); let interface = match rest.split_once(':') { @@ -390,10 +393,3 @@ fn extract_world_exports(contents: &str) -> Vec { exports } - -fn strip_comment(line: &str) -> &str { - match line.split_once("//") { - Some((before, _)) => before, - None => line, - } -} diff --git a/sdk/base-macros/src/util.rs b/sdk/base-macros/src/util.rs index 0d90f2fbf..198a52d65 100644 --- a/sdk/base-macros/src/util.rs +++ b/sdk/base-macros/src/util.rs @@ -59,3 +59,13 @@ pub fn generated_wit_folder_at(manifest_dir: &Path) -> Result { })?; Ok(wit_deps_dir) } + +/// Strips line comments starting with `//` from the provided source line. +/// +/// Returns the portion of the line before the comment, or the entire line if no comment exists. +pub fn strip_line_comment(line: &str) -> &str { + match line.split_once("//") { + Some((before, _)) => before, + None => line, + } +} From a48d060c386e1000dea8c8143466f0ef8e0002b1 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 27 Nov 2025 18:03:43 +0200 Subject: [PATCH 39/70] refactor: add an error if `run` has more than 2 arguments, add comments. --- sdk/base-macros/src/generate.rs | 2 +- sdk/base-macros/src/script.rs | 9 +++++++++ sdk/base-macros/src/util.rs | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 3faca5787..d4dbec99c 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -585,7 +585,7 @@ mod tests { /// Helper to parse Rust source into a syn::File. fn parse_file(src: &str) -> File { - syn::parse_str(src).expect("failed to parse test source") + syn::parse_str(src).unwrap_or_else(|e| panic!("failed to parse test source: {e}\n{src}")) } #[test] diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index d3b9b7230..532be0f69 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -113,8 +113,17 @@ pub(crate) fn expand( /// it is treated as an "injected" wrapper struct that will be instantiated via /// `Default::default()` and passed to the user's function. /// +/// Only up to 2 parameters are supported: `(arg: Word)` or `(arg: Word, account: Account)`. +/// /// Returns `Some((ident, type))` if a second parameter exists, `None` otherwise. fn parse_injected_param(input_fn: &ItemFn) -> syn::Result> { + if input_fn.sig.inputs.len() > 2 { + return Err(syn::Error::new( + input_fn.sig.span(), + "fn run accepts at most 2 parameters: (arg: Word) or (arg: Word, account: Account)", + )); + } + let Some(second_arg) = input_fn.sig.inputs.iter().nth(1) else { return Ok(None); }; diff --git a/sdk/base-macros/src/util.rs b/sdk/base-macros/src/util.rs index 198a52d65..a4d43bab0 100644 --- a/sdk/base-macros/src/util.rs +++ b/sdk/base-macros/src/util.rs @@ -63,6 +63,9 @@ pub fn generated_wit_folder_at(manifest_dir: &Path) -> Result { /// Strips line comments starting with `//` from the provided source line. /// /// Returns the portion of the line before the comment, or the entire line if no comment exists. +/// +/// **Note:** This is a simple heuristic that doesn't account for `//` appearing +/// inside string literals. Only use for WIT source parsing where this is not an issue. pub fn strip_line_comment(line: &str) -> &str { match line.split_once("//") { Some((before, _)) => before, From e2a55fa59d9fdb9d68f1cf75e434cca6edf6632e Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 27 Nov 2025 19:49:27 +0200 Subject: [PATCH 40/70] refactor: simplify `world` handling in `generate_bindings`, add test --- sdk/base-macros/src/generate.rs | 103 ++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 5 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index d4dbec99c..68918bd88 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -156,19 +156,22 @@ pub(crate) fn expand(input: proc_macro::TokenStream) -> proc_macro::TokenStream } /// Generates WIT bindings using `wit-bindgen` directly instead of the `generate!` macro. +/// +/// The `world` parameter specifies which world to generate bindings for. This should already +/// be resolved by the caller (either from inline WIT or from the local wit/ directory). +/// If `None`, wit-bindgen will attempt to select a default world from the loaded packages. fn generate_bindings( args: &GenerateArgs, config: &manifest_paths::ResolvedWit, - world_override: Option<&str>, + world: Option<&str>, ) -> Result { let inline_src = args.inline.as_ref().map(|src| src.value()); let inline_ref = inline_src.as_deref(); let wit_sources = load_wit_sources(&config.paths, inline_ref)?; - let world_spec = world_override.or(config.world.as_deref()); - let world = wit_sources + let world_id = wit_sources .resolve - .select_world(&wit_sources.packages, world_spec) + .select_world(&wit_sources.packages, world) .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; let mut opts = Opts { @@ -183,7 +186,7 @@ fn generate_bindings( let mut generated_files = wit_bindgen_core::Files::default(); let mut generator = opts.build(); generator - .generate(&wit_sources.resolve, world, &mut generated_files) + .generate(&wit_sources.resolve, world_id, &mut generated_files) .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; let (_, src_bytes) = generated_files @@ -950,4 +953,94 @@ mod tests { assert_eq!(parsed.with_entries[0].0, "miden:a/b"); assert_eq!(parsed.with_entries[1].0, "miden:c/d"); } + + /// Integration test verifying that `augment_generated_bindings` produces valid Rust code. + /// + /// This test simulates realistic wit-bindgen output with custom types, multiple methods, + /// and verifies the augmented output parses as valid Rust and contains the expected + /// wrapper struct with properly qualified type paths. + #[test] + fn test_augment_generated_bindings_integration() { + // Simulate more realistic wit-bindgen output with types and multiple leaf modules + let src = r#" + mod miden { + mod basic_wallet { + mod basic_wallet { + pub struct AssetInfo { + pub amount: u64, + } + + pub fn receive_asset(asset: AssetInfo) {} + pub fn move_asset_to_note(asset: AssetInfo, note_idx: u32) -> bool { true } + fn _internal_helper() {} // Should be skipped (underscore prefix) + } + } + mod other_component { + mod other_component { + pub fn do_something(value: u64) -> u64 { value } + } + } + } + mod exports { + mod my_export { + pub fn exported_fn() {} // Should be skipped (exports module) + } + } + "#; + + let tokens: TokenStream2 = src.parse().unwrap(); + let result = augment_generated_bindings(tokens).unwrap(); + + // Verify the output parses as valid Rust + let parsed: File = + syn::parse2(result.clone()).expect("augmented bindings should be valid Rust syntax"); + + // Find the Account struct and impl + let has_account_struct = parsed + .items + .iter() + .any(|item| matches!(item, Item::Struct(s) if s.ident == "Account")); + let has_account_impl = parsed.items.iter().any(|item| { + matches!(item, Item::Impl(i) if i.self_ty.to_token_stream().to_string() == "Account") + }); + + assert!(has_account_struct, "should generate Account struct"); + assert!(has_account_impl, "should generate Account impl"); + + // Find the impl block and verify methods + let impl_block = parsed + .items + .iter() + .find_map(|item| match item { + Item::Impl(i) if i.self_ty.to_token_stream().to_string() == "Account" => Some(i), + _ => None, + }) + .expect("Account impl should exist"); + + let method_names: Vec = impl_block + .items + .iter() + .filter_map(|item| match item { + ImplItem::Fn(f) => Some(f.sig.ident.to_string()), + _ => None, + }) + .collect(); + + // Should include methods from both leaf modules + assert!(method_names.contains(&"receive_asset".to_string())); + assert!(method_names.contains(&"move_asset_to_note".to_string())); + assert!(method_names.contains(&"do_something".to_string())); + + // Should NOT include internal helper or exported functions + assert!(!method_names.contains(&"_internal_helper".to_string())); + assert!(!method_names.contains(&"exported_fn".to_string())); + + // Verify type qualification in the result string + let result_str = result.to_string(); + // AssetInfo should be qualified with its module path + assert!( + result_str.contains("miden :: basic_wallet :: basic_wallet :: AssetInfo"), + "custom types should be qualified with module path" + ); + } } From 9f59d5a934ccf44869764c4be15d6942c77667a2 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 28 Nov 2025 13:05:48 +0200 Subject: [PATCH 41/70] refactor: check the script's `run` signature against expected, extract struct name, add comments --- sdk/base-macros/src/generate.rs | 14 +++++++---- sdk/base-macros/src/script.rs | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 68918bd88..d821617db 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -15,6 +15,9 @@ use wit_bindgen_rust::{Opts, WithOption}; use crate::manifest_paths; +/// Name of the wrapper struct generated to aggregate imported interface methods. +const WRAPPER_STRUCT_NAME: &str = "Account"; + #[derive(Default)] struct GenerateArgs { inline: Option, @@ -229,7 +232,7 @@ fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result collect_wrapper_methods(&file.items, &mut Vec::new(), &mut collected_methods)?; if !collected_methods.is_empty() { - let struct_ident = syn::Ident::new("Account", Span::call_site()); + let struct_ident = syn::Ident::new(WRAPPER_STRUCT_NAME, Span::call_site()); let struct_item: ItemStruct = parse_quote! { /// Wrapper struct providing methods that delegate to imported interface functions. #[derive(Clone, Copy, Default)] @@ -404,7 +407,6 @@ fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Resul let method_doc = format!("Calls `{}` from `{}`.", sig.ident, format_module_path(module_path)); let doc_attr: Attribute = parse_quote!(#[doc = #method_doc]); let inline_attr: Attribute = parse_quote!(#[inline(always)]); - let allow_unused_attr: Attribute = parse_quote!(#[allow(unused_variables)]); let body_tokens = match &sig.output { ReturnType::Default => quote!({ #call_expr; }), @@ -413,7 +415,7 @@ fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Resul let block = syn::parse2(body_tokens)?; Ok(ImplItemFn { - attrs: vec![doc_attr, inline_attr, allow_unused_attr], + attrs: vec![doc_attr, inline_attr], vis: func.vis.clone(), defaultness: None, sig, @@ -473,6 +475,11 @@ fn qualify_signature_types(sig: &mut syn::Signature, module_path: &[syn::Ident]) } /// Returns true if the name is a primitive type or common std type that shouldn't be qualified. +/// +/// This list covers Rust primitives and common standard library types. WIT-generated bindings +/// only use a subset of these (primitives, String, Vec, Option, Result), but we include +/// additional common types for safety. Types like `Rc`, `Arc`, `RefCell` are not used by +/// wit-bindgen and are intentionally omitted. fn is_primitive_or_std_type(name: &str) -> bool { matches!( name, @@ -497,7 +504,6 @@ fn is_primitive_or_std_type(name: &str) -> bool { | "Vec" | "Option" | "Result" - | "Box" | "Self" ) } diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index 532be0f69..6d4b14b9f 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -117,6 +117,13 @@ pub(crate) fn expand( /// /// Returns `Some((ident, type))` if a second parameter exists, `None` otherwise. fn parse_injected_param(input_fn: &ItemFn) -> syn::Result> { + if input_fn.sig.inputs.is_empty() { + return Err(syn::Error::new( + input_fn.sig.span(), + "fn run requires at least one parameter: (arg: Word) or (arg: Word, account: Account)", + )); + } + if input_fn.sig.inputs.len() > 2 { return Err(syn::Error::new( input_fn.sig.span(), @@ -124,6 +131,29 @@ fn parse_injected_param(input_fn: &ItemFn) -> syn::Result { + if !matches!(pat_type.pat.as_ref(), Pat::Ident(_)) { + return Err(syn::Error::new( + pat_type.pat.span(), + "first parameter must be a simple identifier (e.g., `arg: Word`)", + )); + } + // Check that the type is `Word` + if !is_word_type(&pat_type.ty) { + return Err(syn::Error::new( + pat_type.ty.span(), + "first parameter must have type `Word` (e.g., `arg: Word`)", + )); + } + } + FnArg::Receiver(receiver) => { + return Err(syn::Error::new(receiver.span(), "unexpected receiver argument")); + } + } + let Some(second_arg) = input_fn.sig.inputs.iter().nth(1) else { return Ok(None); }; @@ -147,6 +177,18 @@ fn parse_injected_param(input_fn: &ItemFn) -> syn::Result bool { + let syn::Type::Path(type_path) = ty else { + return false; + }; + if type_path.qself.is_some() { + return false; + } + let last_segment = type_path.path.segments.last(); + last_segment.is_some_and(|seg| seg.ident == "Word" && seg.arguments.is_empty()) +} + fn build_script_wit( error_span: Span, export_interface: &'static str, From 9de8f8ac399fb3873992c071be45bd5600732d8f Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 28 Nov 2025 15:41:52 +0200 Subject: [PATCH 42/70] refactor: add function name clashing check in `Account` --- sdk/base-macros/src/generate.rs | 127 ++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 6 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index d821617db..bafd83fe8 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -1,4 +1,4 @@ -use std::{env, fs, path::PathBuf}; +use std::{collections::HashMap, env, fs, path::PathBuf}; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::{quote, ToTokens}; @@ -226,11 +226,31 @@ fn generate_bindings( /// free functions in leaf modules. This provides a more ergonomic API /// (e.g., `Account::default().receive_asset(asset)` instead of /// `miden::basic_wallet::basic_wallet::receive_asset(asset)`). +/// +/// ## Leaf Module Selection +/// +/// Only "leaf" modules (those containing no nested modules) contribute methods to the +/// wrapper struct. This is because wit-bindgen generates a module hierarchy where: +/// - Non-leaf modules represent WIT package namespaces (e.g., `miden::basic_wallet`) +/// - Leaf modules represent actual WIT interfaces with callable functions +/// +/// For example, given the module structure: +/// ```text +/// miden/ +/// basic_wallet/ +/// basic_wallet/ <- leaf module, methods collected here +/// receive_asset() +/// send_asset() +/// ``` +/// Only functions from `miden::basic_wallet::basic_wallet` are wrapped. fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result { let mut file: File = syn::parse2(tokens)?; let mut collected_methods = Vec::new(); collect_wrapper_methods(&file.items, &mut Vec::new(), &mut collected_methods)?; + // Check for method name collisions across different interfaces + check_method_name_collisions(&collected_methods)?; + if !collected_methods.is_empty() { let struct_ident = syn::Ident::new(WRAPPER_STRUCT_NAME, Span::call_site()); let struct_item: ItemStruct = parse_quote! { @@ -242,7 +262,9 @@ fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result let mut impl_item: ItemImpl = parse_quote! { impl #struct_ident {} }; - impl_item.items.extend(collected_methods.into_iter().map(ImplItem::Fn)); + impl_item + .items + .extend(collected_methods.into_iter().map(|cm| ImplItem::Fn(cm.method))); file.items.push(Item::Struct(struct_item)); file.items.push(Item::Impl(impl_item)); @@ -338,6 +360,13 @@ fn push_path_entry(opts: &mut Opts, key: &str, value: &str) { opts.with.push((key.to_string(), WithOption::Path(value.to_string()))); } +/// A collected wrapper method along with its source module path. +struct CollectedMethod { + method: ImplItemFn, + /// The module path where this method originated (e.g., "miden::basic_wallet::basic_wallet"). + source_path: String, +} + /// Recursively walks all modules and collects wrapper methods from leaf modules. /// /// The `path` parameter tracks the current module path for generating correct call paths. @@ -345,7 +374,7 @@ fn push_path_entry(opts: &mut Opts, key: &str, value: &str) { fn collect_wrapper_methods( items: &[Item], path: &mut Vec, - methods_out: &mut Vec, + methods_out: &mut Vec, ) -> syn::Result<()> { for item in items.iter() { if let Item::Mod(module) = item { @@ -369,7 +398,7 @@ fn collect_wrapper_methods( fn collect_methods_from_module( items: &[Item], path: &[syn::Ident], - methods_out: &mut Vec, + methods_out: &mut Vec, ) -> syn::Result<()> { if !should_generate_struct(path, items) { return Ok(()); @@ -383,8 +412,12 @@ fn collect_methods_from_module( }) .collect(); + let source_path = format_module_path(path); for func in functions { - methods_out.push(build_wrapper_method(func, path)?); + methods_out.push(CollectedMethod { + method: build_wrapper_method(func, path)?, + source_path: source_path.clone(), + }); } Ok(()) @@ -588,6 +621,35 @@ fn format_module_path(path: &[syn::Ident]) -> String { path.iter().map(|ident| ident.to_string()).collect::>().join("::") } +/// Checks for method name collisions across collected wrapper methods. +/// +/// If multiple imported interfaces define functions with the same name, they would all be +/// added to the `Account` struct, causing a compilation error. This function detects such +/// collisions early and provides a clear error message indicating which interfaces conflict. +fn check_method_name_collisions(methods: &[CollectedMethod]) -> syn::Result<()> { + let mut seen: HashMap = HashMap::new(); + + for collected in methods { + let method_name = collected.method.sig.ident.to_string(); + + if let Some(existing_path) = seen.get(&method_name) { + return Err(Error::new( + Span::call_site(), + format!( + "method name collision in generated `{WRAPPER_STRUCT_NAME}` struct: \ + `{method_name}` is defined in both `{existing_path}` and `{}`. Consider \ + using the original module paths directly instead of the wrapper struct.", + collected.source_path + ), + )); + } + + seen.insert(method_name, &collected.source_path); + } + + Ok(()) +} + #[cfg(test)] mod tests { use super::*; @@ -739,7 +801,7 @@ mod tests { assert_eq!(methods.len(), 2); // Check method names - let method_names: Vec<_> = methods.iter().map(|m| m.sig.ident.to_string()).collect(); + let method_names: Vec<_> = methods.iter().map(|m| m.method.sig.ident.to_string()).collect(); assert!(method_names.contains(&"receive_asset".to_string())); assert!(method_names.contains(&"send_asset".to_string())); } @@ -1049,4 +1111,57 @@ mod tests { "custom types should be qualified with module path" ); } + + #[test] + fn test_method_name_collision_detected() { + // Two different interfaces with the same function name + let src = r#" + mod miden { + mod interface_a { + mod interface_a { + pub fn transfer(amount: u64) {} + } + } + mod interface_b { + mod interface_b { + pub fn transfer(value: u32) {} + } + } + } + "#; + + let tokens: TokenStream2 = src.parse().unwrap(); + let result = augment_generated_bindings(tokens); + + assert!(result.is_err(), "should detect method name collision"); + let err_msg = result.unwrap_err().to_string(); + assert!( + err_msg.contains("method name collision"), + "error should mention collision: {err_msg}" + ); + assert!(err_msg.contains("transfer"), "error should mention the colliding method name"); + } + + #[test] + fn test_no_collision_different_names() { + let src = r#" + mod miden { + mod interface_a { + mod interface_a { + pub fn transfer_a(amount: u64) {} + } + } + mod interface_b { + mod interface_b { + pub fn transfer_b(value: u32) {} + } + } + } + "#; + + let tokens: TokenStream2 = src.parse().unwrap(); + let result = augment_generated_bindings(tokens); + + assert!(result.is_ok(), "should not detect collision for different method names"); + } } From baf8d5bf6c15eafdac70cc29643c451b1587baee Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 09:39:58 +0200 Subject: [PATCH 43/70] feature(sdk): make account tx kernel functions callable via `self.` Add `NativeAccount` and `ActiveAccount` trait with methods calling the tx kernel functions from the corresponding modules. --- examples/basic-wallet/src/lib.rs | 8 +- sdk/base-macros/src/component_macro/mod.rs | 7 ++ sdk/base-sys/src/bindings/active_account.rs | 85 +++++++++++++++++++++ sdk/base-sys/src/bindings/native_account.rs | 40 ++++++++++ 4 files changed, 136 insertions(+), 4 deletions(-) diff --git a/examples/basic-wallet/src/lib.rs b/examples/basic-wallet/src/lib.rs index 02de8de33..ea64538b8 100644 --- a/examples/basic-wallet/src/lib.rs +++ b/examples/basic-wallet/src/lib.rs @@ -6,7 +6,7 @@ // // extern crate alloc; -use miden::{component, native_account, output_note, Asset, NoteIdx}; +use miden::{component, output_note, Asset, NoteIdx}; #[component] struct MyAccount; @@ -19,8 +19,8 @@ impl MyAccount { /// /// # Arguments /// * `asset` - The asset to be added to the account - pub fn receive_asset(&self, asset: Asset) { - native_account::add_asset(asset); + pub fn receive_asset(&mut self, asset: Asset) { + self.add_asset(asset); } /// Moves an asset from the account to a note. @@ -32,7 +32,7 @@ impl MyAccount { /// * `asset` - The asset to move from the account to the note /// * `note_idx` - The index of the note to receive the asset pub fn move_asset_to_note(&self, asset: Asset, note_idx: NoteIdx) { - let asset = native_account::remove_asset(asset); + let asset = self.remove_asset(asset); output_note::add_asset(asset, note_idx); } } diff --git a/sdk/base-macros/src/component_macro/mod.rs b/sdk/base-macros/src/component_macro/mod.rs index db6444b8c..c32e318b9 100644 --- a/sdk/base-macros/src/component_macro/mod.rs +++ b/sdk/base-macros/src/component_macro/mod.rs @@ -173,6 +173,8 @@ fn expand_component_struct( #runtime_boilerplate #input_struct #default_impl + impl ::miden::native_account::NativeAccount for #struct_name {} + impl ::miden::active_account::ActiveAccount for #struct_name {} #link_section }) } @@ -284,6 +286,11 @@ fn expand_component_impl( Ok(quote! { ::miden::generate!(inline = #inline_literal, with = { #(#custom_with_entries)* }); + // Bring account traits into scope so users can call `self.add_asset()`, etc. + #[allow(unused_imports)] + use ::miden::native_account::NativeAccount as _; + #[allow(unused_imports)] + use ::miden::active_account::ActiveAccount as _; #impl_block impl #guest_trait_path for #component_type { #(#guest_methods)* diff --git a/sdk/base-sys/src/bindings/active_account.rs b/sdk/base-sys/src/bindings/active_account.rs index 5c56b04e2..928c44a1b 100644 --- a/sdk/base-sys/src/bindings/active_account.rs +++ b/sdk/base-sys/src/bindings/active_account.rs @@ -187,3 +187,88 @@ pub fn has_procedure(proc_root: Word) -> bool { != Felt::from_u32(0) } } + +/// Trait that provides active account operations for components. +/// +/// This trait is automatically implemented for types marked with the `#[component]` macro. +pub trait ActiveAccount { + /// Returns the account ID of the active account. + fn get_id(&self) -> AccountId { + get_id() + } + + /// Returns the nonce of the active account. + fn get_nonce(&self) -> Felt { + get_nonce() + } + + /// Returns the active account commitment at the beginning of the transaction. + fn get_initial_commitment(&self) -> Word { + get_initial_commitment() + } + + /// Computes and returns the commitment of the current account data. + fn compute_commitment(&self) -> Word { + compute_commitment() + } + + /// Returns the code commitment of the active account. + fn get_code_commitment(&self) -> Word { + get_code_commitment() + } + + /// Returns the initial storage commitment of the active account. + fn get_initial_storage_commitment(&self) -> Word { + get_initial_storage_commitment() + } + + /// Computes the latest storage commitment of the active account. + fn compute_storage_commitment(&self) -> Word { + compute_storage_commitment() + } + + /// Returns the balance of the fungible asset identified by `faucet_id`. + /// + /// # Panics + /// + /// Propagates kernel errors if the referenced asset is non-fungible or the + /// account vault invariants are violated. + fn get_balance(&self, faucet_id: AccountId) -> Felt { + get_balance(faucet_id) + } + + /// Returns the initial balance of the fungible asset identified by `faucet_id`. + fn get_initial_balance(&self, faucet_id: AccountId) -> Felt { + get_initial_balance(faucet_id) + } + + /// Returns `true` if the active account vault currently contains the specified non-fungible asset. + fn has_non_fungible_asset(&self, asset: Asset) -> bool { + has_non_fungible_asset(asset) + } + + /// Returns the vault root of the active account at the beginning of the transaction. + fn get_initial_vault_root(&self) -> Word { + get_initial_vault_root() + } + + /// Returns the current vault root of the active account. + fn get_vault_root(&self) -> Word { + get_vault_root() + } + + /// Returns the number of procedures exported by the active account. + fn get_num_procedures(&self) -> Felt { + get_num_procedures() + } + + /// Returns the procedure root for the procedure at `index`. + fn get_procedure_root(&self, index: u8) -> Word { + get_procedure_root(index) + } + + /// Returns `true` if the procedure identified by `proc_root` exists on the active account. + fn has_procedure(&self, proc_root: Word) -> bool { + has_procedure(proc_root) + } +} diff --git a/sdk/base-sys/src/bindings/native_account.rs b/sdk/base-sys/src/bindings/native_account.rs index e113f6573..6953fa342 100644 --- a/sdk/base-sys/src/bindings/native_account.rs +++ b/sdk/base-sys/src/bindings/native_account.rs @@ -106,3 +106,43 @@ pub fn was_procedure_called(proc_root: Word) -> bool { ) != Felt::from_u32(0) } } + +/// Trait that provides native account operations for components. +/// +/// This trait is automatically implemented for types marked with the `#[component]` macro. +pub trait NativeAccount { + /// Add the specified asset to the vault. + /// + /// Returns the final asset in the account vault defined as follows: If `asset` is + /// a non-fungible asset, then returns the same as `asset`. If `asset` is a + /// fungible asset, then returns the total fungible asset in the account + /// vault after `asset` was added to it. + fn add_asset(&mut self, asset: Asset) -> Asset { + add_asset(asset) + } + + /// Remove the specified asset from the vault. + /// + /// Panics: + /// - The fungible asset is not found in the vault. + /// - The amount of the fungible asset in the vault is less than the amount to be removed. + /// - The non-fungible asset is not found in the vault. + fn remove_asset(&self, asset: Asset) -> Asset { + remove_asset(asset) + } + + /// Increments the account nonce by one and returns the new nonce. + fn incr_nonce(&mut self) -> Felt { + incr_nonce() + } + + /// Computes and returns the commitment to the native account's delta for this transaction. + fn compute_delta_commitment(&self) -> Word { + compute_delta_commitment() + } + + /// Returns `true` if the procedure identified by `proc_root` was called during the transaction. + fn was_procedure_called(&self, proc_root: Word) -> bool { + was_procedure_called(proc_root) + } +} From 1f8c81eb784d59c92eddaa4a2a9f78dd5a8bd327 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 11:34:22 +0200 Subject: [PATCH 44/70] refactor: migrate auth component examples to full `#[component]` macro, Fix expects in tests. --- examples/auth-component-no-auth/src/lib.rs | 30 ++----- .../auth-component-rpo-falcon512/src/lib.rs | 24 ++---- .../examples/auth_component_no_auth.hir | 40 ++++----- .../examples/auth_component_no_auth.masm | 32 +++---- .../examples/auth_component_no_auth.wat | 9 +- .../examples/auth_component_rpo_falcon512.hir | 86 +++++++++---------- .../auth_component_rpo_falcon512.masm | 66 +++++++------- .../examples/auth_component_rpo_falcon512.wat | 8 +- .../src/rust_masm_tests/examples.rs | 25 +++--- .../rust_masm_tests/rust_sdk/base/account.rs | 26 +++--- 10 files changed, 162 insertions(+), 184 deletions(-) diff --git a/examples/auth-component-no-auth/src/lib.rs b/examples/auth-component-no-auth/src/lib.rs index ccfb6b3ad..f19bf52bc 100644 --- a/examples/auth-component-no-auth/src/lib.rs +++ b/examples/auth-component-no-auth/src/lib.rs @@ -8,36 +8,22 @@ // extern crate alloc; // use alloc::vec::Vec; -// Global allocator to use heap memory in no-std environment -#[global_allocator] -static ALLOC: miden::BumpAlloc = miden::BumpAlloc::new(); - -// Required for no-std crates -#[cfg(not(test))] -#[panic_handler] -fn my_panic(_info: &core::panic::PanicInfo) -> ! { - loop {} -} - -miden::generate!(); -bindings::export!(AuthComponent); - -use miden::{active_account, native_account, *}; - -use crate::bindings::exports::miden::base::authentication_component::Guest; +use miden::{component, Word}; +#[component] struct AuthComponent; -impl Guest for AuthComponent { - fn auth_procedure(_arg: Word) { +#[component] +impl AuthComponent { + pub fn auth_procedure(&mut self, _arg: Word) { // translated from MASM at // https://github.com/0xMiden/miden-base/blob/e4912663276ab8eebb24b84d318417cb4ea0bba3/crates/miden-lib/asm/account_components/no_auth.masm?plain=1 - let init_comm = active_account::get_initial_commitment(); - let curr_comm = active_account::compute_commitment(); + let init_comm = self.get_initial_commitment(); + let curr_comm = self.compute_commitment(); // check if the account state has changed by comparing initial and final commitments if curr_comm != init_comm { // if the account has been updated, increment the nonce - native_account::incr_nonce(); + self.incr_nonce(); } } } diff --git a/examples/auth-component-rpo-falcon512/src/lib.rs b/examples/auth-component-rpo-falcon512/src/lib.rs index 0f46e69b0..32c96ae35 100644 --- a/examples/auth-component-rpo-falcon512/src/lib.rs +++ b/examples/auth-component-rpo-falcon512/src/lib.rs @@ -3,15 +3,9 @@ extern crate alloc; use miden::{ - component, felt, hash_words, intrinsics::advice::adv_insert, native_account, tx, Felt, Value, - ValueAccess, Word, + component, felt, hash_words, intrinsics::advice::adv_insert, tx, Felt, Value, ValueAccess, Word, }; -use crate::bindings::exports::miden::base::authentication_component::Guest; - -miden::generate!(); -bindings::export!(AuthComponent); - /// Authentication component storage/layout. /// /// Public key is expected to be in the slot 0. Matches MASM constant `PUBLIC_KEY_SLOT=0` in @@ -27,13 +21,14 @@ struct AuthComponent { owner_public_key: Value, } -impl Guest for AuthComponent { - fn auth_procedure(_arg: Word) { +#[component] +impl AuthComponent { + pub fn auth_procedure(&mut self, _arg: Word) { let ref_block_num = tx::get_block_number(); - let final_nonce = native_account::incr_nonce(); + let final_nonce = self.incr_nonce(); // Gather tx summary parts - let acct_delta_commit = native_account::compute_delta_commitment(); + let acct_delta_commit = self.compute_delta_commitment(); let input_notes_commit = tx::get_input_notes_commitment(); let output_notes_commit = tx::get_output_notes_commitment(); @@ -44,14 +39,13 @@ impl Guest for AuthComponent { // On the advice stack the words are expected to be in the reverse order tx_summary.reverse(); // Insert tx summary into advice map under key `msg` - adv_insert(msg.clone(), &tx_summary); + adv_insert(msg, &tx_summary); // Load public key from storage slot 0 - let storage = Self::default(); - let pub_key: Word = storage.owner_public_key.read(); + let pub_key: Word = self.owner_public_key.read(); // Emit signature request event to advice stack, - miden::emit_falcon_sig_to_stack(msg.clone(), pub_key.clone()); + miden::emit_falcon_sig_to_stack(msg, pub_key); // Verify the signature loaded on the advice stack. miden::rpo_falcon512_verify(pub_key, msg); diff --git a/tests/integration/expected/examples/auth_component_no_auth.hir b/tests/integration/expected/examples/auth_component_no_auth.hir index c6157e73a..4fafeea1b 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.hir +++ b/tests/integration/expected/examples/auth_component_no_auth.hir @@ -1,4 +1,4 @@ -builtin.component miden:base/authentication-component@1.0.0 { +builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { builtin.module public @auth_component_no_auth { private builtin.function @__wasm_call_ctors() { ^block5: @@ -10,20 +10,20 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden:base/authentication-component@1.0.0#auth-procedure(v0: felt, v1: felt, v2: felt, v3: felt) { + 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:base/authentication-component@1.0.0/auth_component_no_auth/__stack_pointer : ptr + 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:base/authentication-component@1.0.0/auth_component_no_auth/__stack_pointer : ptr + 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; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/wit_bindgen::rt::run_ctors_once() + 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:base/authentication-component@1.0.0/auth_component_no_auth/miden::active_account::get_initial_commitment(v13) + 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]; @@ -58,10 +58,10 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.store v39, v33; v40 = arith.constant 48 : i32; v41 = arith.add v9, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden_stdlib_sys::intrinsics::word::Word::reverse(v9, v41) + hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden_stdlib_sys::intrinsics::word::Word::reverse(v9, v41) v381 = arith.constant 32 : i32; v43 = arith.add v9, v381 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::active_account::compute_commitment(v43) + 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]; @@ -98,7 +98,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v73 = arith.add v9, v372 : i32 #[overflow = wrapping]; v70 = arith.constant 16 : i32; v71 = arith.add v9, v70 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden_stdlib_sys::intrinsics::word::Word::reverse(v71, v73) + hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden_stdlib_sys::intrinsics::word::Word::reverse(v71, v73) v75 = arith.constant 16 : u32; v74 = hir.bitcast v9 : u32; v76 = arith.add v74, v75 : u32 #[overflow = checked]; @@ -113,7 +113,7 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.assertz v83 #[code = 250]; v84 = hir.int_to_ptr v81 : ptr; v85 = hir.load v84 : felt; - v86 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/intrinsics::felt::eq(v80, v85) : i32 + 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; @@ -143,7 +143,7 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.assertz v104 #[code = 250]; v105 = hir.int_to_ptr v102 : ptr; v106 = hir.load v105 : felt; - v107 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/intrinsics::felt::eq(v99, v106) : i32 + 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; @@ -173,7 +173,7 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.assertz v125 #[code = 250]; v126 = hir.int_to_ptr v123 : ptr; v127 = hir.load v126 : felt; - v128 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/intrinsics::felt::eq(v120, v127) : i32 + 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; @@ -203,7 +203,7 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.assertz v146 #[code = 250]; v147 = hir.int_to_ptr v144 : ptr; v148 = hir.load v147 : felt; - v149 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/intrinsics::felt::eq(v141, v148) : i32 + 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; @@ -226,7 +226,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v330 = scf.index_switch v329 : i32 case 0 { ^block12: - v156 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::native_account::incr_nonce() : felt + 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; } default { @@ -235,7 +235,7 @@ builtin.component miden:base/authentication-component@1.0.0 { }; v349 = arith.constant 64 : i32; v160 = arith.add v330, v349 : i32 #[overflow = wrapping]; - v161 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_no_auth/__stack_pointer : ptr + 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; builtin.ret ; @@ -243,7 +243,7 @@ builtin.component miden:base/authentication-component@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block17: - v164 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_no_auth/GOT.data.internal.__memory_base : ptr + 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; @@ -260,10 +260,10 @@ builtin.component miden:base/authentication-component@1.0.0 { scf.yield ; } else { ^block20: - v176 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_no_auth/GOT.data.internal.__memory_base : ptr + 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; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/__wasm_call_ctors() + 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]; @@ -277,7 +277,7 @@ builtin.component miden:base/authentication-component@1.0.0 { private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v186: i32, v187: i32) { ^block21(v186: i32, v187: i32): - v190 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_no_auth/__stack_pointer : ptr + 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; @@ -470,7 +470,7 @@ builtin.component miden:base/authentication-component@1.0.0 { 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:base/authentication-component@1.0.0/auth_component_no_auth/miden:base/authentication-component@1.0.0#auth-procedure(v314, v315, v316, v317) + 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) 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 f99bec676..5486fa27f 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.masm +++ b/tests/integration/expected/examples/auth_component_no_auth.masm @@ -1,11 +1,11 @@ -# mod miden:base/authentication-component@1.0.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:base/authentication-component@1.0.0::init + exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::init trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden:base/authentication-component@1.0.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 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/authentication-component@1.0.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( @@ -49,7 +49,7 @@ proc auth_component_no_auth::bindings::__link_custom_section_describing_imports( end @callconv("C") -proc miden:base/authentication-component@1.0.0#auth-procedure( +proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( felt, felt, felt, @@ -81,7 +81,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( nop trace.240 nop - exec.::miden:base/authentication-component@1.0.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 @@ -89,7 +89,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::active_account::get_initial_commitment + exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden::active_account::get_initial_commitment trace.252 nop push.40 @@ -172,7 +172,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( dup.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.32 @@ -180,7 +180,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::active_account::compute_commitment + exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden::active_account::compute_commitment trace.252 nop push.40 @@ -265,7 +265,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.16 @@ -302,7 +302,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::intrinsics::felt::eq + 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 @@ -352,7 +352,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::intrinsics::felt::eq + 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 @@ -402,7 +402,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::intrinsics::felt::eq + 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 @@ -452,7 +452,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::intrinsics::felt::eq + 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 @@ -486,7 +486,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( drop trace.240 nop - exec.::miden:base/authentication-component@1.0.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::native_account::incr_nonce trace.252 nop drop @@ -548,7 +548,7 @@ proc wit_bindgen::rt::run_ctors_once( nop trace.240 nop - exec.::miden:base/authentication-component@1.0.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 push.1 diff --git a/tests/integration/expected/examples/auth_component_no_auth.wat b/tests/integration/expected/examples/auth_component_no_auth.wat index 7f6a0a377..534f70666 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.wat +++ b/tests/integration/expected/examples/auth_component_no_auth.wat @@ -21,11 +21,11 @@ (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:base/authentication-component@1.0.0#auth-procedure" (func $miden:base/authentication-component@1.0.0#auth-procedure)) + (export "miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure" (func $miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure)) (elem (;0;) (i32.const 1) func $auth_component_no_auth::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $auth_component_no_auth::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:base/authentication-component@1.0.0#auth-procedure (;2;) (type 1) (param f32 f32 f32 f32) + (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) global.get $__stack_pointer i32.const 64 @@ -201,12 +201,13 @@ 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") ) (alias export 0 "word" (type (;1;))) (core instance (;0;) (instantiate 0)) (alias core export 0 "memory" (core memory (;0;))) (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/authentication-component@1.0.0#auth-procedure" (core func (;0;))) + (alias core export 0 "miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure" (core func (;0;))) (func (;0;) (type 2) (canon lift (core func 0))) (alias export 0 "felt" (type (;3;))) (alias export 0 "word" (type (;4;))) @@ -230,5 +231,5 @@ (with "import-type-word0" (type 1)) ) ) - (export (;2;) "miden:base/authentication-component@1.0.0" (instance 1)) + (export (;2;) "miden:auth-component-no-auth/auth-component-no-auth@0.1.0" (instance 1)) ) diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir index 7752b57de..0d831231f 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir @@ -1,4 +1,4 @@ -builtin.component miden:base/authentication-component@1.0.0 { +builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0 { builtin.module public @auth_component_rpo_falcon512 { private builtin.function @__wasm_call_ctors() { ^block5: @@ -10,22 +10,22 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden:base/authentication-component@1.0.0#auth-procedure(v0: felt, v1: felt, v2: felt, v3: felt) { + 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:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + 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 112 : i32; v14 = arith.sub v12, v13 : i32 #[overflow = wrapping]; - v15 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + 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; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/wit_bindgen::rt::run_ctors_once() - v17 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_block_number() : felt - v18 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::native_account::incr_nonce() : felt + 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 80 : i32; v20 = arith.add v14, v19 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::native_account::compute_delta_commitment(v20) + 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 88 : u32; v21 = hir.bitcast v14 : u32; v23 = arith.add v21, v22 : u32 #[overflow = checked]; @@ -60,17 +60,17 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.store v46, v40; v47 = arith.constant 96 : i32; v48 = arith.add v14, v47 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v14, v48) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v14, v48) v49 = arith.constant 16 : i32; v50 = arith.add v14, v49 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_input_notes_commitment(v50) + 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:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_output_notes_commitment(v52) + 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:base/authentication-component@1.0.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v4) : felt + 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 v835 = arith.constant 0 : i32; - v57 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v835) : felt + v57 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v835) : felt v59 = arith.constant 60 : u32; v58 = hir.bitcast v14 : u32; v60 = arith.add v58, v59 : u32 #[overflow = checked]; @@ -104,10 +104,10 @@ builtin.component miden:base/authentication-component@1.0.0 { v81 = hir.int_to_ptr v78 : ptr; hir.store v81, v55; v831 = arith.constant 0 : i32; - v83 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v831) : felt + v83 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v831) : felt v830 = arith.constant 0 : i32; - v85 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v830) : felt - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/intrinsics::felt::assert_eq(v83, v85) + v85 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v830) : felt + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::assert_eq(v83, v85) v649 = arith.constant 2 : u32; v87 = hir.bitcast v14 : u32; v89 = arith.shr v87, v649 : u32; @@ -116,7 +116,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v94 = arith.add v14, v828 : i32 #[overflow = wrapping]; v829 = arith.constant 16 : i32; v92 = arith.add v90, v829 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/std::crypto::hashes::rpo::hash_memory_words(v90, v92, v94) + 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(v90, v92, v94) v827 = arith.constant 88 : u32; v95 = hir.bitcast v14 : u32; v97 = arith.add v95, v827 : u32 #[overflow = checked]; @@ -153,7 +153,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v124 = arith.add v14, v819 : i32 #[overflow = wrapping]; v121 = arith.constant 64 : i32; v122 = arith.add v14, v121 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v122, v124) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v122, v124) v126 = arith.constant 64 : u32; v125 = hir.bitcast v14 : u32; v127 = arith.add v125, v126 : u32 #[overflow = checked]; @@ -205,7 +205,7 @@ builtin.component miden:base/authentication-component@1.0.0 { ^block14: v200 = arith.constant 4 : i32; v163 = arith.add v760, v759 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks(v163, v761, v200) + 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(v163, v761, v200) v168 = arith.constant -16 : i32; v169 = arith.add v761, v168 : i32 #[overflow = wrapping]; v811 = arith.constant 16 : i32; @@ -266,12 +266,12 @@ builtin.component miden:base/authentication-component@1.0.0 { v799 = arith.constant 4 : i32; v800 = arith.constant 96 : i32; v199 = arith.add v754, v800 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::advice::adv_insert(v199, v754, v799) + 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(v199, v754, v799) v798 = arith.constant 0 : i32; - v202 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/>::from(v798) : felt + v202 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/>::from(v798) : felt v797 = arith.constant 80 : i32; v204 = arith.add v754, v797 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::active_account::get_item(v202, v204) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::active_account::get_item(v202, v204) v796 = arith.constant 88 : u32; v205 = hir.bitcast v754 : u32; v207 = arith.add v205, v796 : u32 #[overflow = checked]; @@ -308,7 +308,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v234 = arith.add v754, v787 : i32 #[overflow = wrapping]; v788 = arith.constant 64 : i32; v232 = arith.add v754, v788 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v232, v234) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v232, v234) v786 = arith.constant 76 : u32; v235 = hir.bitcast v754 : u32; v237 = arith.add v235, v786 : u32 #[overflow = checked]; @@ -341,11 +341,11 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.assertz v260 #[code = 250]; v261 = hir.int_to_ptr v258 : ptr; v262 = hir.load v261 : felt; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/intrinsics::advice::emit_falcon_sig_to_stack(v755, v756, v757, v758, v241, v248, v255, v262) - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/std::crypto::dsa::rpo_falcon512::verify(v241, v248, v255, v262, v755, v756, v757, v758) + 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(v755, v756, v757, v758, v241, v248, v255, v262) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/std::crypto::dsa::rpo_falcon512::verify(v241, v248, v255, v262, v755, v756, v757, v758) v778 = arith.constant 112 : i32; v264 = arith.add v754, v778 : i32 #[overflow = wrapping]; - v265 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v265 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v266 = hir.bitcast v265 : ptr; hir.store v266, v264; builtin.ret ; @@ -353,7 +353,7 @@ builtin.component miden:base/authentication-component@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v268 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/GOT.data.internal.__memory_base : ptr + v268 = 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 v269 = hir.bitcast v268 : ptr; v270 = hir.load v269 : i32; v271 = arith.constant 1048584 : i32; @@ -370,10 +370,10 @@ builtin.component miden:base/authentication-component@1.0.0 { scf.yield ; } else { ^block18: - v280 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/GOT.data.internal.__memory_base : ptr + v280 = 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 v281 = hir.bitcast v280 : ptr; v282 = hir.load v281 : i32; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__wasm_call_ctors() + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__wasm_call_ctors() v840 = arith.constant 1 : u8; v842 = arith.constant 1048584 : i32; v284 = arith.add v282, v842 : i32 #[overflow = wrapping]; @@ -387,21 +387,21 @@ builtin.component miden:base/authentication-component@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::get_block_number() -> felt { ^block19: - v291 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::tx::get_block_number() : felt + v291 = 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 v291; }; private builtin.function @miden_base_sys::bindings::tx::get_input_notes_commitment(v292: i32) { ^block21(v292: i32): - v294 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v294 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v295 = hir.bitcast v294 : ptr; v296 = hir.load v295 : i32; v297 = arith.constant 32 : i32; v298 = arith.sub v296, v297 : i32 #[overflow = wrapping]; - v299 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v299 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v300 = hir.bitcast v299 : ptr; hir.store v300, v298; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::tx::get_input_notes_commitment(v298) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::tx::get_input_notes_commitment(v298) v302 = arith.constant 8 : u32; v301 = hir.bitcast v298 : u32; v303 = arith.add v301, v302 : u32 #[overflow = checked]; @@ -434,10 +434,10 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.store v324, v318; v325 = arith.constant 16 : i32; v326 = arith.add v298, v325 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v292, v326) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v292, v326) v843 = arith.constant 32 : i32; v328 = arith.add v298, v843 : i32 #[overflow = wrapping]; - v329 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v329 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v330 = hir.bitcast v329 : ptr; hir.store v330, v328; builtin.ret ; @@ -445,15 +445,15 @@ builtin.component miden:base/authentication-component@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::get_output_notes_commitment(v331: i32) { ^block23(v331: i32): - v333 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v333 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v334 = hir.bitcast v333 : ptr; v335 = hir.load v334 : i32; v336 = arith.constant 32 : i32; v337 = arith.sub v335, v336 : i32 #[overflow = wrapping]; - v338 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v338 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v339 = hir.bitcast v338 : ptr; hir.store v339, v337; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::tx::get_output_notes_commitment(v337) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::tx::get_output_notes_commitment(v337) v341 = arith.constant 8 : u32; v340 = hir.bitcast v337 : u32; v342 = arith.add v340, v341 : u32 #[overflow = checked]; @@ -486,10 +486,10 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.store v363, v357; v364 = arith.constant 16 : i32; v365 = arith.add v337, v364 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v331, v365) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::word::Word::reverse(v331, v365) v848 = arith.constant 32 : i32; v367 = arith.add v337, v848 : i32 #[overflow = wrapping]; - v368 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v368 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v369 = hir.bitcast v368 : ptr; hir.store v369, v367; builtin.ret ; @@ -582,7 +582,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v891 = arith.constant 2 : u32; v435 = arith.shl v401, v891 : i32; v436 = arith.add v432, v435 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/intrinsics::advice::adv_insert_mem(v408, v415, v422, v427, v432, v436) + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::advice::adv_insert_mem(v408, v415, v422, v427, v432, v436) builtin.ret ; }; @@ -596,7 +596,7 @@ builtin.component miden:base/authentication-component@1.0.0 { private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v442: i32, v443: i32) { ^block35(v442: i32, v443: i32): - v446 = builtin.global_symbol @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v446 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr v447 = hir.bitcast v446 : ptr; v448 = hir.load v447 : i32; v449 = arith.constant 16 : i32; @@ -881,7 +881,7 @@ builtin.component miden:base/authentication-component@1.0.0 { public builtin.function @auth__procedure(v645: felt, v646: felt, v647: felt, v648: felt) { ^block77(v645: felt, v646: felt, v647: felt, v648: felt): - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden:base/authentication-component@1.0.0#auth-procedure(v645, v646, v647, v648) + 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(v645, v646, v647, v648) 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 d78fbeb1f..a4ac9bdad 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm @@ -1,11 +1,11 @@ -# mod miden:base/authentication-component@1.0.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:base/authentication-component@1.0.0::init + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::init trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden:base/authentication-component@1.0.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 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/authentication-component@1.0.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( @@ -49,7 +49,7 @@ proc auth_component_rpo_falcon512::bindings::__link_custom_section_describing_im end @callconv("C") -proc miden:base/authentication-component@1.0.0#auth-procedure( +proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure( felt, felt, felt, @@ -81,17 +81,17 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( nop trace.240 nop - exec.::miden:base/authentication-component@1.0.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 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_block_number + 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 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::native_account::incr_nonce + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::native_account::incr_nonce trace.252 nop push.80 @@ -99,7 +99,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.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::native_account::compute_delta_commitment trace.252 nop push.88 @@ -182,7 +182,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( dup.3 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.16 @@ -190,7 +190,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.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_input_notes_commitment trace.252 nop push.32 @@ -198,19 +198,19 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_output_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.0 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 trace.252 nop push.0 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 trace.252 nop push.60 @@ -288,19 +288,19 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( push.0 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 trace.252 nop push.0 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 + 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:base/authentication-component@1.0.0::auth_component_rpo_falcon512::intrinsics::felt::assert_eq + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::assert_eq trace.252 nop push.2 @@ -316,7 +316,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( movup.2 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::std::crypto::hashes::rpo::hash_memory_words + 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.88 @@ -401,7 +401,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.64 @@ -502,7 +502,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks + 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 trace.252 nop push.4294967280 @@ -664,13 +664,13 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.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 push.0 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::>::from + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::>::from trace.252 nop push.80 @@ -679,7 +679,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::active_account::get_item + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::active_account::get_item trace.252 nop push.88 @@ -764,7 +764,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.76 @@ -845,7 +845,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( dup.12 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::intrinsics::advice::emit_falcon_sig_to_stack + 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 movup.4 @@ -860,7 +860,7 @@ proc miden:base/authentication-component@1.0.0#auth-procedure( swap.3 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::std::crypto::dsa::rpo_falcon512::verify + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::std::crypto::dsa::rpo_falcon512::verify trace.252 nop push.112 @@ -918,7 +918,7 @@ proc wit_bindgen::rt::run_ctors_once( nop trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::__wasm_call_ctors + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::__wasm_call_ctors trace.252 nop push.1 @@ -955,7 +955,7 @@ proc miden_base_sys::bindings::tx::get_block_number( ) -> felt trace.240 nop - exec.::miden:base/authentication-component@1.0.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::tx::get_block_number trace.252 nop end @@ -987,7 +987,7 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( dup.0 trace.240 nop - exec.::miden:base/authentication-component@1.0.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::tx::get_input_notes_commitment trace.252 nop push.8 @@ -1067,7 +1067,7 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( movup.2 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.32 @@ -1109,7 +1109,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( dup.0 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::tx::get_output_notes_commitment + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::tx::get_output_notes_commitment trace.252 nop push.8 @@ -1189,7 +1189,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( movup.2 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse trace.252 nop push.32 @@ -1378,7 +1378,7 @@ proc miden_stdlib_sys::intrinsics::advice::adv_insert( swap.5 trace.240 nop - exec.::miden:base/authentication-component@1.0.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 diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat index 196fafad5..ebb1b523d 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat @@ -26,11 +26,11 @@ (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:base/authentication-component@1.0.0#auth-procedure" (func $miden:base/authentication-component@1.0.0#auth-procedure)) + (export "miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure" (func $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure)) (elem (;0;) (i32.const 1) func $auth_component_rpo_falcon512::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $auth_component_rpo_falcon512::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:base/authentication-component@1.0.0#auth-procedure (;2;) (type 1) (param f32 f32 f32 f32) + (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) global.get $__stack_pointer i32.const 112 @@ -462,7 +462,7 @@ (core instance (;0;) (instantiate 0)) (alias core export 0 "memory" (core memory (;0;))) (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/authentication-component@1.0.0#auth-procedure" (core func (;0;))) + (alias core export 0 "miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure" (core func (;0;))) (func (;0;) (type 2) (canon lift (core func 0))) (alias export 0 "felt" (type (;3;))) (alias export 0 "word" (type (;4;))) @@ -486,5 +486,5 @@ (with "import-type-word0" (type 1)) ) ) - (export (;2;) "miden:base/authentication-component@1.0.0" (instance 1)) + (export (;2;) "miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0" (instance 1)) ) diff --git a/tests/integration/src/rust_masm_tests/examples.rs b/tests/integration/src/rust_masm_tests/examples.rs index 91a5d1e72..f6c7a2ca6 100644 --- a/tests/integration/src/rust_masm_tests/examples.rs +++ b/tests/integration/src/rust_masm_tests/examples.rs @@ -360,7 +360,6 @@ fn auth_component_no_auth() { test.expect_masm(expect_file![format!("../../expected/examples/auth_component_no_auth.masm")]); let auth_comp_package = test.compiled_package(); let lib = auth_comp_package.unwrap_library(); - let expected_module = "miden:base/authentication-component@1.0.0"; let expected_function = "auth__procedure"; let exports = lib .exports() @@ -368,12 +367,8 @@ fn auth_component_no_auth() { .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}'" + lib.exports().any(|export| { export.name.name.as_str() == expected_function }), + "expected one of the exports to contain and function '{expected_function}'" ); // Test that the package loads @@ -400,15 +395,17 @@ fn auth_component_rpo_falcon512() { )]); let auth_comp_package = test.compiled_package(); let lib = auth_comp_package.unwrap_library(); - let expected_module = "miden:base/authentication-component@1.0.0"; let expected_function = "auth__procedure"; + + let exports = lib + .exports() + .map(|e| format!("{}::{}", e.name.module, e.name.name.as_str())) + .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}'" + lib.exports().any(|export| { export.name.name.as_str() == expected_function }), + "expected one of the exports to contain function '{expected_function}'" ); // Test that the package loads 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 835b1b0f6..4b7274036 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 @@ -75,7 +75,7 @@ fn rust_sdk_account_get_code_commitment_binding() { run_account_binding_test( "rust_sdk_account_get_code_commitment_binding", "pub fn binding(&self) -> Word { - active_account::get_code_commitment() + self.get_code_commitment() }", ); } @@ -85,7 +85,7 @@ fn rust_sdk_account_get_initial_storage_commitment_binding() { run_account_binding_test( "rust_sdk_account_get_initial_storage_commitment_binding", "pub fn binding(&self) -> Word { - active_account::get_initial_storage_commitment() + self.get_initial_storage_commitment() }", ); } @@ -95,7 +95,7 @@ fn rust_sdk_account_compute_storage_commitment_binding() { run_account_binding_test( "rust_sdk_account_compute_storage_commitment_binding", "pub fn binding(&self) -> Word { - active_account::compute_storage_commitment() + self.compute_storage_commitment() }", ); } @@ -105,7 +105,7 @@ fn rust_sdk_account_compute_commitment_binding() { run_account_binding_test( "rust_sdk_account_compute_commitment_binding", "pub fn binding(&self) -> Word { - active_account::compute_commitment() + self.compute_commitment() }", ); } @@ -115,7 +115,7 @@ fn rust_sdk_account_compute_delta_commitment_binding() { run_account_binding_test( "rust_sdk_account_compute_delta_commitment_binding", "pub fn binding(&self) -> Word { - native_account::compute_delta_commitment() + self.compute_delta_commitment() }", ); } @@ -126,7 +126,7 @@ fn rust_sdk_account_get_initial_balance_binding() { "rust_sdk_account_get_initial_balance_binding", "pub fn binding(&self) -> Felt { let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; - active_account::get_initial_balance(faucet) + self.get_initial_balance(faucet) }", ); } @@ -137,7 +137,7 @@ fn rust_sdk_account_has_non_fungible_asset_binding() { "rust_sdk_account_has_non_fungible_asset_binding", "pub fn binding(&self) -> Felt { let asset = Asset::from([Felt::from_u32(0); 4]); - if active_account::has_non_fungible_asset(asset) { + if self.has_non_fungible_asset(asset) { Felt::from_u32(1) } else { Felt::from_u32(0) @@ -151,7 +151,7 @@ fn rust_sdk_account_get_initial_vault_root_binding() { run_account_binding_test( "rust_sdk_account_get_initial_vault_root_binding", "pub fn binding(&self) -> Word { - active_account::get_initial_vault_root() + self.get_initial_vault_root() }", ); } @@ -161,7 +161,7 @@ fn rust_sdk_account_get_vault_root_binding() { run_account_binding_test( "rust_sdk_account_get_vault_root_binding", "pub fn binding(&self) -> Word { - active_account::get_vault_root() + self.get_vault_root() }", ); } @@ -171,7 +171,7 @@ fn rust_sdk_account_get_num_procedures_binding() { run_account_binding_test( "rust_sdk_account_get_num_procedures_binding", "pub fn binding(&self) -> Felt { - active_account::get_num_procedures() + self.get_num_procedures() }", ); } @@ -181,7 +181,7 @@ fn rust_sdk_account_get_procedure_root_binding() { run_account_binding_test( "rust_sdk_account_get_procedure_root_binding", "pub fn binding(&self) -> Word { - active_account::get_procedure_root(0) + self.get_procedure_root(0) }", ); } @@ -192,7 +192,7 @@ fn rust_sdk_account_has_procedure_binding() { "rust_sdk_account_has_procedure_binding", "pub fn binding(&self) -> Felt { let proc_root = Word::from([Felt::from_u32(0); 4]); - if active_account::has_procedure(proc_root) { + if self.has_procedure(proc_root) { Felt::from_u32(1) } else { Felt::from_u32(0) @@ -207,7 +207,7 @@ fn rust_sdk_account_was_procedure_called_binding() { "rust_sdk_account_was_procedure_called_binding", "pub fn binding(&self) -> Felt { let proc_root = Word::from([Felt::from_u32(0); 4]); - if native_account::was_procedure_called(proc_root) { + if self.was_procedure_called(proc_root) { Felt::from_u32(1) } else { Felt::from_u32(0) From bfe60cfdac0c5207c264a7e8a90719095fcb33f9 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 11:40:42 +0200 Subject: [PATCH 45/70] feature(sdk): implement `ActiveAccount` for the generated `Account` struct in scripts. --- examples/p2id-note/src/lib.rs | 2 +- sdk/base-macros/src/script.rs | 14 +- .../rust-sdk/account-test/Cargo.lock | 1157 ++++++++++++++++- 3 files changed, 1102 insertions(+), 71 deletions(-) diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 14aecef8a..61b0c9692 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -18,7 +18,7 @@ fn run(_arg: Word, account: Account) { let target_account_id_suffix = inputs[1]; let target_account = AccountId::from(target_account_id_prefix, target_account_id_suffix); - let current_account = active_account::get_id(); + let current_account = account.get_id(); assert_eq!(current_account, target_account); let assets = active_note::get_assets(); diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index 6d4b14b9f..cb5960ba8 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -77,12 +77,16 @@ pub(crate) fn expand( let runtime_boilerplate = runtime_boilerplate(); // Generate the call to the user's function, with optional injected parameter - let (instantiation, call) = match &injected_param { + let (instantiation, call, trait_impl) = match &injected_param { Some((ident, ty)) => ( quote! { let #ident = <#ty as ::core::default::Default>::default(); }, quote! { #fn_ident(arg, #ident) }, + // Implement ActiveAccount for the injected type so users can call account.get_id(), etc. + quote! { + impl ::miden::active_account::ActiveAccount for #ty {} + }, ), - None => (quote! {}, quote! { #fn_ident(arg) }), + None => (quote! {}, quote! { #fn_ident(arg) }, quote! {}), }; let expanded = quote! { @@ -93,6 +97,12 @@ pub(crate) fn expand( ::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; diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock index 62ca746bc..f2b291770 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock @@ -2,6 +2,31 @@ # It is not intended for manual editing. version = 3 +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -11,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" @@ -44,6 +119,42 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -105,6 +216,8 @@ version = "1.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f4ac86a9e5bc1e2b3449ab9d7d3a6a405e3d1bb28d7b9be8614f55846ae3766" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -114,6 +227,53 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[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 = "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -129,6 +289,43 @@ dependencies = [ "libc", ] +[[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.6" @@ -136,9 +333,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 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", +] + +[[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 = "derive_more" version = "2.0.1" @@ -166,7 +401,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -175,12 +412,70 @@ 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" @@ -190,24 +485,106 @@ 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" +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.59.0", +] + +[[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 = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[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 = "foldhash" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62d91fd049c123429b018c47887d3f75a265540dd3c30ba9cb7bae9197edb03a" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -291,6 +668,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -303,16 +694,33 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[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.3" @@ -328,6 +736,24 @@ 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.2.1" @@ -351,6 +777,27 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +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" @@ -366,6 +813,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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" @@ -376,6 +857,20 @@ dependencies = [ "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" @@ -439,6 +934,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.12" @@ -485,7 +986,7 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miden" -version = "0.6.0" +version = "0.7.1" dependencies = [ "miden-base", "miden-base-sys", @@ -496,11 +997,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2871bc4f392053cd115d4532e4b0fb164791829cc94b35641ed72480547dfd1" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -508,9 +1010,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345ae47710bbb4c6956dcc669a537c5cf2081879b6238c0df6da50e84a77ea3f" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -522,9 +1024,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab186ac7061b47415b923cf2da88df505f25c333f7caace80fb7760cf9c0590" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -534,6 +1036,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -543,7 +1046,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.6.0" +version = "0.7.1" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -552,32 +1055,37 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.6.0" +version = "0.7.1" dependencies = [ + "heck", "miden-objects", "proc-macro2", "quote", "semver 1.0.26", "syn", "toml", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] name = "miden-base-sys" -version = "0.6.0" +version = "0.8.0" dependencies = [ "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ad0b07592486e02de3ff7f3bff1d7fa81b1a7120f7f0b1027d650d810bbab" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -587,35 +1095,59 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "0048d2d987f215bc9633ced499a8c488d0e2474350c765f904b87cae3462acb7" dependencies = [ "blake3", + "cc", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3b38aace84e157fb02aba8f8ae85bbf8c3afdcdbdf8190fbe7476f3be7ef44" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e5b15ea6fe0f80688fde2d6e4f5a3b66417d2541388b7a6cf967c6a8a2bc0" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.3", "thiserror", ] @@ -630,13 +1162,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9d87c128f467874b272fec318e792385e35b14d200408a10d30909228db864" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -645,6 +1178,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", @@ -657,7 +1192,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", + "supports-color", + "supports-hyperlinks", + "supports-unicode", "syn", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -677,33 +1216,42 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b513a36886b910d71c39b17f37e48179e251fca49cebcbcf57094bef9941f63" +checksum = "ace4018bb2d6cdbcff4d86d8af5ade8efca9f0479f7e5775c7f09cfab5f91ebe" dependencies = [ "bech32", - "getrandom", + "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", ] [[package]] name = "miden-processor" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64304339292cc4e50a7b534197326824eeb21f3ffaadd955be63cc57093854ed" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -717,17 +1265,33 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.6.0" +version = "0.7.0" + +[[package]] +name = "miden-stdlib" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e90a5de45a1e6213ff17b66fff8accde0bbc64264e2c22bbcb9a895f8f3b767" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "thiserror", +] [[package]] name = "miden-stdlib-sys" -version = "0.6.0" +version = "0.7.1" [[package]] name = "miden-utils-diagnostics" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bf9a2c1cf3e3694d0eb347695a291602a57f817dd001ac838f300799576a69" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -736,21 +1300,31 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb026e69ae937b2a83bf69ea86577e0ec2450cb22cce163190b9fd42f2972b63" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a305e5e2c68d10bcb8e2ed3dc38e54bc3a538acc9eadc154b713d5bb47af22" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -761,15 +1335,33 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -865,10 +1457,19 @@ dependencies = [ name = "num-traits" version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ - "autocfg", - "libm", + "memchr", ] [[package]] @@ -877,6 +1478,18 @@ 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 = "overload" version = "0.1.1" @@ -909,7 +1522,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -949,6 +1562,51 @@ 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.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -974,6 +1632,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" @@ -995,7 +1668,27 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" dependencies = [ - "rand_core", + "rand_chacha", + "rand_core 0.9.3", +] + +[[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.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1003,6 +1696,47 @@ 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" +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.3", +] + +[[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" @@ -1015,13 +1749,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1036,9 +1770,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1057,6 +1791,22 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[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.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1075,6 +1825,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.20" @@ -1108,6 +1871,20 @@ 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" @@ -1134,18 +1911,28 @@ 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", @@ -1173,6 +1960,26 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" +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" @@ -1198,6 +2005,16 @@ 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 = "siphasher" version = "1.0.1" @@ -1221,6 +2038,19 @@ 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 = "string_cache" @@ -1243,6 +2073,33 @@ dependencies = [ "vte", ] +[[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.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "804f44ed3c63152de6a9f90acbea1a110441de43006ea51bcce8f436196a288b" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + [[package]] name = "syn" version = "2.0.106" @@ -1266,7 +2123,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]] @@ -1278,6 +2135,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" @@ -1319,6 +2186,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.22" @@ -1327,7 +2203,7 @@ checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" dependencies = [ "indexmap", "serde", - "serde_spanned", + "serde_spanned 0.6.8", "toml_datetime", "toml_edit", ] @@ -1349,7 +2225,7 @@ checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ "indexmap", "serde", - "serde_spanned", + "serde_spanned 0.6.8", "toml_datetime", "toml_write", "winnow", @@ -1444,6 +2320,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" @@ -1474,6 +2356,22 @@ 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" @@ -1505,6 +2403,12 @@ dependencies = [ "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 = "wasi" version = "0.14.2+wasi-0.2.4" @@ -1627,7 +2531,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]] @@ -1645,7 +2549,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.1", "windows-numerics", ] @@ -1666,7 +2570,7 @@ checksum = "46ec44dc15085cea82cf9c78f85a9114c463a369786585ad2882d1ff0b0acf40" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.1", "windows-result", "windows-strings", ] @@ -1678,7 +2582,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.1", "windows-threading", ] @@ -1710,6 +2614,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +[[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" @@ -1717,7 +2627,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -1726,7 +2636,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b895b5356fc36103d0f64dd1e94dfa7ac5633f1c9dd6e80fe9ec4adef69e09d" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] [[package]] @@ -1735,7 +2645,16 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a7ab927b2637c19b3dbe0965e75d8f2d30bdd697a1516191cad2ec4df8fb28a" dependencies = [ - "windows-link", + "windows-link 0.1.1", +] + +[[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]] @@ -1744,7 +2663,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]] @@ -1753,14 +2696,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]] @@ -1769,21 +2712,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.1", ] +[[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" @@ -1796,24 +2757,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" @@ -2014,3 +2999,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[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.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" From a822d1ea27ceced08ab945ae8c6d6675b7917241 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 13:15:59 +0200 Subject: [PATCH 46/70] fix: make `NativeAccount::remove_asset` require `&mut self` --- examples/basic-wallet/src/lib.rs | 2 +- sdk/base-sys/src/bindings/native_account.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/basic-wallet/src/lib.rs b/examples/basic-wallet/src/lib.rs index ea64538b8..e3a3e0b43 100644 --- a/examples/basic-wallet/src/lib.rs +++ b/examples/basic-wallet/src/lib.rs @@ -31,7 +31,7 @@ impl MyAccount { /// # Arguments /// * `asset` - The asset to move from the account to the note /// * `note_idx` - The index of the note to receive the asset - pub fn move_asset_to_note(&self, asset: Asset, note_idx: NoteIdx) { + pub fn move_asset_to_note(&mut self, asset: Asset, note_idx: NoteIdx) { let asset = self.remove_asset(asset); output_note::add_asset(asset, note_idx); } diff --git a/sdk/base-sys/src/bindings/native_account.rs b/sdk/base-sys/src/bindings/native_account.rs index 6953fa342..127fcd460 100644 --- a/sdk/base-sys/src/bindings/native_account.rs +++ b/sdk/base-sys/src/bindings/native_account.rs @@ -127,7 +127,7 @@ pub trait NativeAccount { /// - The fungible asset is not found in the vault. /// - The amount of the fungible asset in the vault is less than the amount to be removed. /// - The non-fungible asset is not found in the vault. - fn remove_asset(&self, asset: Asset) -> Asset { + fn remove_asset(&mut self, asset: Asset) -> Asset { remove_asset(asset) } From f8cb8d59b242d6e04d0c00b49d0996bc081556ce Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 13:16:47 +0200 Subject: [PATCH 47/70] refactor: migrate p2ide note example to use passed `Account` --- examples/p2ide-note/src/lib.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index ec0893b71..2217093d2 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -9,27 +9,30 @@ use miden::*; -use crate::bindings::miden::basic_wallet::basic_wallet::receive_asset; +use crate::bindings::Account; -fn consume_assets() { +fn consume_assets(account: &Account) { let assets = active_note::get_assets(); for asset in assets { - receive_asset(asset); + // TODO: `receieve_asset` should require `account` to be &mut + // Only when account is Wasm CM resource? Otherwise its a bunch of free functions + // (WIT interface has no notion of borrowing) + account.receive_asset(asset); } } -fn reclaim_assets(consuming_account: AccountId) { +fn reclaim_assets(account: &Account, consuming_account: AccountId) { let creator_account = active_note::get_sender(); if consuming_account == creator_account { - consume_assets(); + consume_assets(account); } else { panic!(); } } #[note_script] -fn run(_arg: Word) { +fn run(_arg: Word, account: Account) { let inputs = active_note::get_inputs(); // make sure the number of inputs is 4 @@ -46,16 +49,16 @@ fn run(_arg: Word) { assert!(block_number >= timelock_height); // get consuming account id - let consuming_account_id = active_account::get_id(); + let consuming_account_id = account.get_id(); // target account id let target_account_id = AccountId::from(target_account_id_prefix, target_account_id_suffix); let is_target = target_account_id == consuming_account_id; if is_target { - consume_assets(); + consume_assets(&account); } else { assert!(reclaim_height >= block_number); - reclaim_assets(consuming_account_id); + reclaim_assets(&account, consuming_account_id); } } From 9c3d50942ef7392f6559018169eee50cf19ba26b Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 13:29:03 +0200 Subject: [PATCH 48/70] fix: make `set_*` methods in SDK account storage API require `&mut self` --- examples/counter-contract/src/lib.rs | 2 +- examples/storage-example/src/lib.rs | 2 +- sdk/base/src/types/storage.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/counter-contract/src/lib.rs b/examples/counter-contract/src/lib.rs index 2b7352478..d3dcce261 100644 --- a/examples/counter-contract/src/lib.rs +++ b/examples/counter-contract/src/lib.rs @@ -25,7 +25,7 @@ impl CounterContract { } /// Increments the counter value stored in the contract's storage map by one. - pub fn increment_count(&self) -> Felt { + pub fn increment_count(&mut self) -> Felt { let key = Word::from([felt!(0), felt!(0), felt!(0), felt!(1)]); let current_value: Felt = self.count_map.get(&key); let new_value = current_value + felt!(1); diff --git a/examples/storage-example/src/lib.rs b/examples/storage-example/src/lib.rs index 0ad1a9ee4..b05ecad52 100644 --- a/examples/storage-example/src/lib.rs +++ b/examples/storage-example/src/lib.rs @@ -38,7 +38,7 @@ struct MyAccount { impl foo::Guest for MyAccount { fn set_asset_qty(pub_key: Word, asset: Asset, qty: Felt) { - let my_account = MyAccount::default(); + let mut my_account = MyAccount::default(); let owner_key: Word = my_account.owner_public_key.read(); if pub_key == owner_key { my_account.asset_qty_map.set(asset, qty); diff --git a/sdk/base/src/types/storage.rs b/sdk/base/src/types/storage.rs index 4037c78f5..376711b86 100644 --- a/sdk/base/src/types/storage.rs +++ b/sdk/base/src/types/storage.rs @@ -3,7 +3,7 @@ use miden_stdlib_sys::Word; pub trait ValueAccess { fn read(&self) -> V; - fn write(&self, value: V) -> (StorageCommitmentRoot, V); + fn write(&mut self, value: V) -> (StorageCommitmentRoot, V); } pub struct Value { @@ -22,7 +22,7 @@ impl + From> ValueAccess for Value { /// - new_root is the new storage commitment. /// - old_value is the previous value of the item. #[inline(always)] - fn write(&self, value: V) -> (StorageCommitmentRoot, V) { + fn write(&mut self, value: V) -> (StorageCommitmentRoot, V) { let (root, old_word) = storage::set_item(self.slot, value.into()); (root, old_word.into()) } @@ -32,7 +32,7 @@ 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(&self, key: K, value: V) -> (StorageCommitmentRoot, V); + fn set(&mut self, key: K, value: V) -> (StorageCommitmentRoot, V); } pub struct StorageMap { @@ -53,7 +53,7 @@ impl + AsRef, V: From + Into> StorageMapAccess (StorageCommitmentRoot, V) { + fn set(&mut self, key: K, value: V) -> (StorageCommitmentRoot, V) { let (root, old_word) = storage::set_map_item(self.slot, key.into(), value.into()); (root, old_word.into()) } From 6f040ee2258f85008275cee8d725279f0bc11401 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 13:29:56 +0200 Subject: [PATCH 49/70] fix: pass generated `Account` struct as `&mut` in the script --- examples/basic-wallet-tx-script/src/lib.rs | 2 +- examples/p2id-note/src/lib.rs | 2 +- examples/p2ide-note/src/lib.rs | 10 +++++----- sdk/base-macros/src/script.rs | 18 +++++++++++++++--- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/examples/basic-wallet-tx-script/src/lib.rs b/examples/basic-wallet-tx-script/src/lib.rs index d33761cef..c0cd4a5d0 100644 --- a/examples/basic-wallet-tx-script/src/lib.rs +++ b/examples/basic-wallet-tx-script/src/lib.rs @@ -23,7 +23,7 @@ const ASSET_START: usize = 8; const ASSET_END: usize = 12; #[tx_script] -fn run(arg: Word, account: Account) { +fn run(arg: Word, account: &mut Account) { let num_felts = adv_push_mapvaln(arg.clone()); let num_felts_u64 = num_felts.as_u64(); assert_eq(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 61b0c9692..dc3c31048 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -12,7 +12,7 @@ use miden::*; use crate::bindings::Account; #[note_script] -fn run(_arg: Word, account: Account) { +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]; diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index 2217093d2..e5292311f 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -11,7 +11,7 @@ use miden::*; use crate::bindings::Account; -fn consume_assets(account: &Account) { +fn consume_assets(account: &mut Account) { let assets = active_note::get_assets(); for asset in assets { // TODO: `receieve_asset` should require `account` to be &mut @@ -21,7 +21,7 @@ fn consume_assets(account: &Account) { } } -fn reclaim_assets(account: &Account, consuming_account: AccountId) { +fn reclaim_assets(account: &mut Account, consuming_account: AccountId) { let creator_account = active_note::get_sender(); if consuming_account == creator_account { @@ -32,7 +32,7 @@ fn reclaim_assets(account: &Account, consuming_account: AccountId) { } #[note_script] -fn run(_arg: Word, account: Account) { +fn run(_arg: Word, account: &mut Account) { let inputs = active_note::get_inputs(); // make sure the number of inputs is 4 @@ -56,9 +56,9 @@ fn run(_arg: Word, account: Account) { let is_target = target_account_id == consuming_account_id; if is_target { - consume_assets(&account); + consume_assets(account); } else { assert!(reclaim_height >= block_number); - reclaim_assets(&account, consuming_account_id); + reclaim_assets(account, consuming_account_id); } } diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index cb5960ba8..bd884f8a3 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -79,8 +79,8 @@ pub(crate) fn expand( // Generate the call to the user's function, with optional injected parameter let (instantiation, call, trait_impl) = match &injected_param { Some((ident, ty)) => ( - quote! { let #ident = <#ty as ::core::default::Default>::default(); }, - quote! { #fn_ident(arg, #ident) }, + quote! { let mut #ident = <#ty as ::core::default::Default>::default(); }, + quote! { #fn_ident(arg, &mut #ident) }, // Implement ActiveAccount for the injected type so users can call account.get_id(), etc. quote! { impl ::miden::active_account::ActiveAccount for #ty {} @@ -179,7 +179,9 @@ fn parse_injected_param(input_fn: &ItemFn) -> syn::Result { Err(syn::Error::new(receiver.span(), "unexpected receiver argument")) @@ -187,6 +189,16 @@ fn parse_injected_param(input_fn: &ItemFn) -> syn::Result syn::Type { + if let syn::Type::Reference(type_ref) = ty { + (*type_ref.elem).clone() + } else { + ty.clone() + } +} + /// Checks if a type is `Word` (handles both `Word` and `miden::Word` paths). fn is_word_type(ty: &syn::Type) -> bool { let syn::Type::Path(type_path) = ty else { From b16199136c5f6d8e93fadac561c075113d9daf6f Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 1 Dec 2025 16:24:28 +0200 Subject: [PATCH 50/70] fix: make every `Account` method `&mut self` until https://github.com/0xMiden/compiler/issues/802 is resolved. --- sdk/base-macros/src/generate.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index bafd83fe8..1cb60327d 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -429,7 +429,9 @@ fn collect_methods_from_module( /// resolve correctly when the method is placed at the bindings root level. fn build_wrapper_method(func: &ItemFn, module_path: &[syn::Ident]) -> syn::Result { let mut sig = func.sig.clone(); - sig.inputs.insert(0, parse_quote!(&self)); + // Make every method `&mut self` as a temporary workaround until + // https://github.com/0xMiden/compiler/issues/802 is resolved + sig.inputs.insert(0, parse_quote!(&mut self)); // Qualify type paths in the signature so they resolve from the bindings root qualify_signature_types(&mut sig, module_path); @@ -870,9 +872,11 @@ mod tests { ]; let method = build_wrapper_method(&func, &path).unwrap(); - // Method should have &self as first parameter + // Method should have &mut self as first parameter assert_eq!(method.sig.inputs.len(), 2); - assert!(matches!(method.sig.inputs.first(), Some(FnArg::Receiver(_)))); + assert!( + matches!(method.sig.inputs.first(), Some(FnArg::Receiver(r)) if r.mutability.is_some()) + ); // Should be public assert!(matches!(method.vis, syn::Visibility::Public(_))); @@ -917,8 +921,8 @@ mod tests { assert!(result_str.contains("fn receive_asset")); assert!(result_str.contains("fn send_asset")); - // Methods should have &self parameter - assert!(result_str.contains("& self")); + // Methods should have &mut self parameter + assert!(result_str.contains("& mut self")); } #[test] From 26a66634d2492db8363a2c2079ab3b53adb9d446 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 2 Dec 2025 13:50:52 +0200 Subject: [PATCH 51/70] fix: check that the script's `run` second arg is `&mut Account` --- sdk/base-macros/src/script.rs | 51 ++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index bd884f8a3..730e517a5 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -123,21 +123,23 @@ pub(crate) fn expand( /// it is treated as an "injected" wrapper struct that will be instantiated via /// `Default::default()` and passed to the user's function. /// -/// Only up to 2 parameters are supported: `(arg: Word)` or `(arg: Word, account: Account)`. +/// Only up to 2 parameters are supported: `(arg: Word)` or `(arg: Word, account: &mut Account)`. /// /// Returns `Some((ident, type))` if a second parameter exists, `None` otherwise. fn parse_injected_param(input_fn: &ItemFn) -> syn::Result> { if input_fn.sig.inputs.is_empty() { return Err(syn::Error::new( input_fn.sig.span(), - "fn run requires at least one parameter: (arg: Word) or (arg: Word, account: Account)", + "fn run requires at least one parameter: (arg: Word) or (arg: Word, account: &mut \ + Account)", )); } if input_fn.sig.inputs.len() > 2 { return Err(syn::Error::new( input_fn.sig.span(), - "fn run accepts at most 2 parameters: (arg: Word) or (arg: Word, account: Account)", + "fn run accepts at most 2 parameters: (arg: Word) or (arg: Word, account: &mut \ + Account)", )); } @@ -179,8 +181,7 @@ fn parse_injected_param(input_fn: &ItemFn) -> syn::Result { @@ -189,14 +190,28 @@ fn parse_injected_param(input_fn: &ItemFn) -> syn::Result syn::Type { - if let syn::Type::Reference(type_ref) = ty { - (*type_ref.elem).clone() - } else { - ty.clone() +/// Ensures the type is `&mut Account` (allowing paths like `crate::bindings::Account`) and returns +/// the underlying `Account` type. +fn expect_mut_account_type(ty: &syn::Type) -> syn::Result { + let syn::Type::Reference(type_ref) = ty else { + return Err(syn::Error::new( + ty.span(), + "second parameter must be typed as `account: &mut Account`", + )); + }; + if type_ref.mutability.is_none() { + return Err(syn::Error::new( + ty.span(), + "second parameter must be typed as `account: &mut Account`", + )); + } + if !is_account_type(&type_ref.elem) { + return Err(syn::Error::new( + ty.span(), + "second parameter must be typed as `account: &mut Account`", + )); } + Ok((*type_ref.elem).clone()) } /// Checks if a type is `Word` (handles both `Word` and `miden::Word` paths). @@ -211,6 +226,18 @@ fn is_word_type(ty: &syn::Type) -> bool { last_segment.is_some_and(|seg| seg.ident == "Word" && seg.arguments.is_empty()) } +/// Checks if a type resolves to `Account` (allowing module-qualified paths). +fn is_account_type(ty: &syn::Type) -> bool { + let syn::Type::Path(type_path) = ty else { + return false; + }; + type_path + .path + .segments + .last() + .is_some_and(|seg| seg.ident == "Account" && seg.arguments.is_empty()) +} + fn build_script_wit( error_span: Span, export_interface: &'static str, From cd643515be73d04ac27f73525353cca08967aad5 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 2 Dec 2025 14:09:18 +0200 Subject: [PATCH 52/70] refactor: introduce `is_account_type` function, mark account trait methods with `#[inline]`. Clean up and fix comments. --- examples/p2ide-note/src/lib.rs | 3 --- sdk/base-macros/src/component_macro/mod.rs | 2 +- sdk/base-macros/src/script.rs | 25 ++++++++------------- sdk/base-sys/src/bindings/active_account.rs | 15 +++++++++++++ sdk/base-sys/src/bindings/native_account.rs | 14 +++++++++++- 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index e5292311f..37bd901fa 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -14,9 +14,6 @@ use crate::bindings::Account; fn consume_assets(account: &mut Account) { let assets = active_note::get_assets(); for asset in assets { - // TODO: `receieve_asset` should require `account` to be &mut - // Only when account is Wasm CM resource? Otherwise its a bunch of free functions - // (WIT interface has no notion of borrowing) account.receive_asset(asset); } } diff --git a/sdk/base-macros/src/component_macro/mod.rs b/sdk/base-macros/src/component_macro/mod.rs index c32e318b9..9455f8196 100644 --- a/sdk/base-macros/src/component_macro/mod.rs +++ b/sdk/base-macros/src/component_macro/mod.rs @@ -238,7 +238,7 @@ fn expand_component_impl( if methods.is_empty() { return Err(syn::Error::new( call_site_span.into(), - "Component `impl` is missing `pub` methods. A component cannot have emty exports.", + "Component `impl` is missing `pub` methods. A component cannot have empty exports.", )); } diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index 730e517a5..dbc126498 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -76,12 +76,13 @@ pub(crate) fn expand( let runtime_boilerplate = runtime_boilerplate(); - // Generate the call to the user's function, with optional injected parameter + // 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. let (instantiation, call, trait_impl) = match &injected_param { Some((ident, ty)) => ( quote! { let mut #ident = <#ty as ::core::default::Default>::default(); }, quote! { #fn_ident(arg, &mut #ident) }, - // Implement ActiveAccount for the injected type so users can call account.get_id(), etc. quote! { impl ::miden::active_account::ActiveAccount for #ty {} }, @@ -154,7 +155,7 @@ fn parse_injected_param(input_fn: &ItemFn) -> syn::Result syn::Result { "second parameter must be typed as `account: &mut Account`", )); } - if !is_account_type(&type_ref.elem) { + if !is_type_named(&type_ref.elem, "Account") { return Err(syn::Error::new( ty.span(), "second parameter must be typed as `account: &mut Account`", @@ -214,28 +215,20 @@ fn expect_mut_account_type(ty: &syn::Type) -> syn::Result { Ok((*type_ref.elem).clone()) } -/// Checks if a type is `Word` (handles both `Word` and `miden::Word` paths). -fn is_word_type(ty: &syn::Type) -> bool { +/// Checks if a type's final path segment matches `name` (allowing module-qualified paths like +/// `miden::Word` or `crate::bindings::Account`). +fn is_type_named(ty: &syn::Type, name: &str) -> bool { let syn::Type::Path(type_path) = ty else { return false; }; if type_path.qself.is_some() { return false; } - let last_segment = type_path.path.segments.last(); - last_segment.is_some_and(|seg| seg.ident == "Word" && seg.arguments.is_empty()) -} - -/// Checks if a type resolves to `Account` (allowing module-qualified paths). -fn is_account_type(ty: &syn::Type) -> bool { - let syn::Type::Path(type_path) = ty else { - return false; - }; type_path .path .segments .last() - .is_some_and(|seg| seg.ident == "Account" && seg.arguments.is_empty()) + .is_some_and(|seg| seg.ident == name && seg.arguments.is_empty()) } fn build_script_wit( diff --git a/sdk/base-sys/src/bindings/active_account.rs b/sdk/base-sys/src/bindings/active_account.rs index 928c44a1b..1528261b1 100644 --- a/sdk/base-sys/src/bindings/active_account.rs +++ b/sdk/base-sys/src/bindings/active_account.rs @@ -193,36 +193,43 @@ pub fn has_procedure(proc_root: Word) -> bool { /// This trait is automatically implemented for types marked with the `#[component]` macro. pub trait ActiveAccount { /// Returns the account ID of the active account. + #[inline] fn get_id(&self) -> AccountId { get_id() } /// Returns the nonce of the active account. + #[inline] fn get_nonce(&self) -> Felt { get_nonce() } /// Returns the active account commitment at the beginning of the transaction. + #[inline] fn get_initial_commitment(&self) -> Word { get_initial_commitment() } /// Computes and returns the commitment of the current account data. + #[inline] fn compute_commitment(&self) -> Word { compute_commitment() } /// Returns the code commitment of the active account. + #[inline] fn get_code_commitment(&self) -> Word { get_code_commitment() } /// Returns the initial storage commitment of the active account. + #[inline] fn get_initial_storage_commitment(&self) -> Word { get_initial_storage_commitment() } /// Computes the latest storage commitment of the active account. + #[inline] fn compute_storage_commitment(&self) -> Word { compute_storage_commitment() } @@ -233,41 +240,49 @@ pub trait ActiveAccount { /// /// Propagates kernel errors if the referenced asset is non-fungible or the /// account vault invariants are violated. + #[inline] fn get_balance(&self, faucet_id: AccountId) -> Felt { get_balance(faucet_id) } /// Returns the initial balance of the fungible asset identified by `faucet_id`. + #[inline] fn get_initial_balance(&self, faucet_id: AccountId) -> Felt { get_initial_balance(faucet_id) } /// Returns `true` if the active account vault currently contains the specified non-fungible asset. + #[inline] fn has_non_fungible_asset(&self, asset: Asset) -> bool { has_non_fungible_asset(asset) } /// Returns the vault root of the active account at the beginning of the transaction. + #[inline] fn get_initial_vault_root(&self) -> Word { get_initial_vault_root() } /// Returns the current vault root of the active account. + #[inline] fn get_vault_root(&self) -> Word { get_vault_root() } /// Returns the number of procedures exported by the active account. + #[inline] fn get_num_procedures(&self) -> Felt { get_num_procedures() } /// Returns the procedure root for the procedure at `index`. + #[inline] fn get_procedure_root(&self, index: u8) -> Word { get_procedure_root(index) } /// Returns `true` if the procedure identified by `proc_root` exists on the active account. + #[inline] fn has_procedure(&self, proc_root: Word) -> bool { has_procedure(proc_root) } diff --git a/sdk/base-sys/src/bindings/native_account.rs b/sdk/base-sys/src/bindings/native_account.rs index 127fcd460..99f5d94c1 100644 --- a/sdk/base-sys/src/bindings/native_account.rs +++ b/sdk/base-sys/src/bindings/native_account.rs @@ -117,31 +117,43 @@ pub trait NativeAccount { /// a non-fungible asset, then returns the same as `asset`. If `asset` is a /// fungible asset, then returns the total fungible asset in the account /// vault after `asset` was added to it. + /// + /// # Panics + /// + /// - 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. + #[inline] fn add_asset(&mut self, asset: Asset) -> Asset { add_asset(asset) } /// Remove the specified asset from the vault. /// - /// Panics: + /// # Panics + /// /// - The fungible asset is not found in the vault. /// - The amount of the fungible asset in the vault is less than the amount to be removed. /// - The non-fungible asset is not found in the vault. + #[inline] fn remove_asset(&mut self, asset: Asset) -> Asset { remove_asset(asset) } /// Increments the account nonce by one and returns the new nonce. + #[inline] fn incr_nonce(&mut self) -> Felt { incr_nonce() } /// Computes and returns the commitment to the native account's delta for this transaction. + #[inline] fn compute_delta_commitment(&self) -> Word { compute_delta_commitment() } /// Returns `true` if the procedure identified by `proc_root` was called during the transaction. + #[inline] fn was_procedure_called(&self, proc_root: Word) -> bool { was_procedure_called(proc_root) } From f3debb2d34ccefea8d2564c369fb1df4715ead86 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 2 Dec 2025 17:08:41 +0200 Subject: [PATCH 53/70] refactor: better error message, clean up test code --- sdk/base-macros/src/generate.rs | 9 ++++++--- tests/integration/src/rust_masm_tests/examples.rs | 10 ++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 1cb60327d..8102dc001 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -309,9 +309,12 @@ fn load_wit_sources( manifest_dir.join(path_buf) }; let normalized = fs::canonicalize(&absolute).unwrap_or(absolute); - let (pkg, sources) = resolve - .push_path(normalized.clone()) - .map_err(|err| Error::new(Span::call_site(), err.to_string()))?; + let (pkg, sources) = resolve.push_path(normalized.clone()).map_err(|err| { + Error::new( + Span::call_site(), + format!("failed to load WIT from '{}': {err}", normalized.display()), + ) + })?; packages.push(pkg); files.extend(sources.paths().map(|p| p.to_owned())); } diff --git a/tests/integration/src/rust_masm_tests/examples.rs b/tests/integration/src/rust_masm_tests/examples.rs index f6c7a2ca6..6d990e411 100644 --- a/tests/integration/src/rust_masm_tests/examples.rs +++ b/tests/integration/src/rust_masm_tests/examples.rs @@ -368,7 +368,7 @@ fn auth_component_no_auth() { // dbg!(&exports); assert!( lib.exports().any(|export| { export.name.name.as_str() == expected_function }), - "expected one of the exports to contain and function '{expected_function}'" + "expected one of the exports to contain function '{expected_function}'" ); // Test that the package loads @@ -397,15 +397,9 @@ fn auth_component_rpo_falcon512() { let lib = auth_comp_package.unwrap_library(); let expected_function = "auth__procedure"; - let exports = lib - .exports() - .map(|e| format!("{}::{}", e.name.module, e.name.name.as_str())) - .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}'" + "expected one of the exports to contain function '{expected_function}'" ); // Test that the package loads From 619433ad51b1e694c0cf0d8d15ca71f876851683 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 3 Dec 2025 15:04:44 +0200 Subject: [PATCH 54/70] refactor: explain `Account` struct role in the doc comments, remove `Copy` and `Clone`. --- sdk/base-macros/src/generate.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index 8102dc001..e0fb3e893 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -254,8 +254,10 @@ fn augment_generated_bindings(tokens: TokenStream2) -> syn::Result if !collected_methods.is_empty() { let struct_ident = syn::Ident::new(WRAPPER_STRUCT_NAME, Span::call_site()); let struct_item: ItemStruct = parse_quote! { - /// Wrapper struct providing methods that delegate to imported interface functions. - #[derive(Clone, Copy, Default)] + /// Wrapper struct that contains all the methods from all the account component + /// dependencies of this script. Each account component dependency method is "merged" + /// into this struct. + #[derive(Default)] pub struct #struct_ident; }; From 400c0691a1a39ac050bcf4c751700555eefce469 Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Fri, 12 Dec 2025 16:20:08 -0500 Subject: [PATCH 55/70] chore: bump toolchain to 1.94/nightly-2025-12-10 --- .github/workflows/ci.yml | 3 +- Cargo.lock | 335 ++++++++---------- Cargo.toml | 10 +- benches/Cargo.toml | 2 +- benches/benches/is_prime_bench.rs | 4 +- codegen/masm/src/artifact.rs | 13 +- codegen/masm/src/lib.rs | 2 - eval/src/evaluator/frame.rs | 2 + eval/src/evaluator/memory.rs | 2 + hir-symbol/Cargo.toml | 1 - hir/Cargo.toml | 1 - hir/src/adt/smalldeque.rs | 2 +- hir/src/ir/region.rs | 2 +- hir/src/ir/symbols.rs | 2 + hir/src/ir/value/range.rs | 8 +- hir/src/lib.rs | 3 +- midenc-compile/Cargo.toml | 1 - midenc-session/src/diagnostics.rs | 2 + rust-toolchain.toml | 4 +- tests/integration/src/testing/eval.rs | 15 +- .../rust-sdk/account-test/Cargo.lock | 12 +- tools/cargo-miden/Cargo.toml | 1 - tools/cargo-miden/src/commands/build.rs | 2 +- 23 files changed, 191 insertions(+), 238 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 278cc8aec..74b78166e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ on: env: # Set the new value when the cache grows too much and we hit the runner's disk space limit # via https://github.com/rust-lang/docs.rs/pull/2433 - RUST_CACHE_KEY: rust-cache-20250528 + RUST_CACHE_KEY: rust-cache-20251212 jobs: lint: @@ -178,7 +178,6 @@ jobs: run: | cargo make test -E 'package(miden-integration-tests) - test(~rust_masm_tests::examples)' - midenc_integration_tests_examples: name: midenc integration tests runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index 4ac1cf291..7496c9ba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,24 +54,21 @@ dependencies = [ ] [[package]] -name = "ahash" -version = "0.8.12" +name = "aho-corasick" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", + "memchr", ] [[package]] -name = "aho-corasick" -version = "1.1.4" +name = "alloca" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4" dependencies = [ - "memchr", + "cc", ] [[package]] @@ -80,6 +77,12 @@ 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 = "android_system_properties" version = "0.1.5" @@ -239,15 +242,15 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +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 = "beef" @@ -312,11 +315,11 @@ dependencies = [ [[package]] name = "blink-alloc" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e669f146bb8b2327006ed94c69cf78c8ec81c100192564654230a40b4f091d82" +checksum = "ce4c15bad517bc0fb4a44523adf470e2c3eb3a365769327acdba849948ea3705" dependencies = [ - "allocator-api2", + "allocator-api2 0.4.0", ] [[package]] @@ -387,13 +390,12 @@ dependencies = [ "miden-mast-package", "midenc-compile", "midenc-session", - "parse_arg 0.1.6", "path-absolutize", "semver 1.0.27", "serde", "serde_json", "tempfile", - "toml_edit 0.23.7", + "toml_edit 0.23.9", "walkdir", ] @@ -408,9 +410,9 @@ dependencies = [ [[package]] name = "cargo-util" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f97c9ef0f8af69bfcecfe4c17a414d7bb978fe794bc1a38952e27b5c5d87492d" +checksum = "03ae3fc62640c9e0235c95b07e68a59a31919d7331bd95961cc811bc0607c87b" dependencies = [ "anyhow", "core-foundation", @@ -426,7 +428,7 @@ dependencies = [ "tempfile", "tracing", "walkdir", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -466,9 +468,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.46" +version = "1.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" +checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" dependencies = [ "find-msvc-tools", "jobserver", @@ -719,25 +721,24 @@ dependencies = [ [[package]] name = "criterion" -version = "0.5.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +checksum = "4d883447757bb0ee46f233e9dc22eb84d93a9508c9b868687b274fc431d886bf" dependencies = [ + "alloca", "anes", "cast", "ciborium", "clap", "criterion-plot", - "is-terminal", - "itertools 0.10.5", + "itertools 0.13.0", "num-traits", - "once_cell", "oorandom", + "page_size", "plotters", "rayon", "regex", "serde", - "serde_derive", "serde_json", "tinytemplate", "walkdir", @@ -745,12 +746,12 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.5.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +checksum = "ed943f81ea2faa8dcecbbfa50164acf95d555afec96a27871663b300e387b2e4" dependencies = [ "cast", - "itertools 0.10.5", + "itertools 0.13.0", ] [[package]] @@ -946,21 +947,22 @@ 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", + "rustc_version 0.4.1", "syn", ] @@ -1462,23 +1464,13 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] - [[package]] name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "allocator-api2", + "allocator-api2 0.2.21", "equivalent", "foldhash 0.1.5", ] @@ -1489,7 +1481,7 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ - "allocator-api2", + "allocator-api2 0.2.21", "equivalent", "foldhash 0.2.0", "rayon", @@ -1544,12 +1536,11 @@ dependencies = [ [[package]] name = "http" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ "bytes", - "fnv", "itoa", ] @@ -1642,9 +1633,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" dependencies = [ "bytes", "futures-channel", @@ -1751,9 +1742,9 @@ dependencies = [ [[package]] name = "instability" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435d80800b936787d62688c927b6490e887c7ef5ff9ce922c6c6050fca75eb9a" +checksum = "6778b0196eefee7df739db78758e5cf9b37412268bfa5650bfeed028aed20d9c" dependencies = [ "darling", "indoc", @@ -1780,17 +1771,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "is-terminal" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.61.2", -] - [[package]] name = "is_ci" version = "1.2.0" @@ -1803,15 +1783,6 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -1872,9 +1843,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.82" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" dependencies = [ "once_cell", "wasm-bindgen", @@ -1957,9 +1928,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.177" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libm" @@ -2072,9 +2043,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "logos" @@ -2291,9 +2262,9 @@ dependencies = [ [[package]] name = "miden-client" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c061c44b345267a9d144fb1cb2d2f7b47a9257f52d7907004297df8a3de1d7" +checksum = "1f0574b4ce13a16f07513bfc8775a6e8d55e64684a82bffd59174cab3a2c1991" dependencies = [ "anyhow", "async-trait", @@ -2326,9 +2297,9 @@ dependencies = [ [[package]] name = "miden-client-sqlite-store" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57f806b34687798a0545177619196017362cb3b67bd0c7003081d1fd5d179c70" +checksum = "594b08393cd63ff092acabae229ae8cc92953471831efdf63650496f4c22dbd6" dependencies = [ "anyhow", "async-trait", @@ -2363,9 +2334,9 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "395e5cc76b64e24533ee55c8d1ff90305b8cad372bdbea4f4f324239e36a895f" dependencies = [ "blake3", "cc", @@ -2395,9 +2366,9 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "c89641b257eb395cf03105ac1c6cbdf3fd9a5450749696af9835c3c47fc6806e" dependencies = [ "quote", "syn", @@ -2518,9 +2489,9 @@ dependencies = [ [[package]] name = "miden-lib" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015992e9a31a4a2667adf2ee795d5f02927a6e9f4e21490ce02fb6395eb6bd41" +checksum = "598582071e5b0ec835d06288857d4ddc0090a98bd4c17e408fa56b2c43f45d73" dependencies = [ "Inflector", "fs-err", @@ -2590,13 +2561,13 @@ dependencies = [ [[package]] name = "miden-node-proto-build" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f083bf3a275076f207fa36d4e247c1554e7310c9b85c245b2fc5fbb69934f437" +checksum = "ec8059a6beaabf87cc58c24a9c51d01fbd6d9b46edc2522125442962ce279ec2" dependencies = [ "fs-err", "miette", - "protox 0.9.0", + "protox 0.9.1", "tonic-prost-build", ] @@ -2608,15 +2579,15 @@ checksum = "86d7a7b3a64c71d33f771d32cde58559207819a64ada9add0acb31857e111b9d" dependencies = [ "fs-err", "miette", - "protox 0.9.0", + "protox 0.9.1", "tonic-prost-build", ] [[package]] name = "miden-objects" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ea15ca33d7735e08e81afd9c9f4f02fc0259ec019fcb4ec44192c205743553" +checksum = "ace4018bb2d6cdbcff4d86d8af5ade8efca9f0479f7e5775c7f09cfab5f91ebe" dependencies = [ "bech32", "getrandom 0.3.4", @@ -2672,9 +2643,9 @@ dependencies = [ [[package]] name = "miden-remote-prover-client" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a02c8c0a548982dc7871df53df6c703119d47c6a3c746604de2979bcff4b42" +checksum = "b319ea63a16a95c04ed16b1626fb9eae581acc79c46050ba231e4d8cb9b06aae" dependencies = [ "getrandom 0.3.4", "miden-node-proto-build", @@ -2736,9 +2707,9 @@ dependencies = [ [[package]] name = "miden-tx" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f5295f8646bc84829ebda923448aebffa2a36f88ef2112b7b4538901e1b34b" +checksum = "2d959064f99ce09fc38e9b6b4dc24c3fa80a63072bf5840a1074ca4ed5e9c911" dependencies = [ "miden-lib", "miden-objects", @@ -2848,7 +2819,6 @@ dependencies = [ name = "midenc-compile" version = "0.5.1" dependencies = [ - "anyhow", "clap", "inventory", "log", @@ -2972,7 +2942,6 @@ dependencies = [ "blink-alloc", "compact_str 0.9.0", "env_logger", - "hashbrown 0.14.5", "hashbrown 0.15.5", "intrusive-collections", "inventory", @@ -3037,7 +3006,6 @@ version = "0.5.1" dependencies = [ "Inflector", "compact_str 0.9.0", - "hashbrown 0.14.5", "hashbrown 0.15.5", "lock_api", "miden-formatting", @@ -3134,9 +3102,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", "log", @@ -3549,6 +3517,16 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -3572,21 +3550,6 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "parse_arg" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f05bccc8b6036fec4e0c511954e3997987a82acb6a0b50642ecf7c744fe225" -dependencies = [ - "parse_arg 1.0.1", -] - -[[package]] -name = "parse_arg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bddc33f680b79eaf1e2e56da792c3c2236f86985bbc3a886e8ddee17ae4d3a4" - [[package]] name = "paste" version = "1.0.15" @@ -3619,9 +3582,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.8.3" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e7521a040efde50c3ab6bbadafbe15ab6dc042686926be59ac35d74607df4" +checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" dependencies = [ "memchr", "ucd-trie", @@ -3629,9 +3592,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.8.3" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187da9a3030dbafabbbfb20cb323b976dc7b7ce91fcd84f2f74d6e31d378e2de" +checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" dependencies = [ "pest", "pest_generator", @@ -3639,9 +3602,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.3" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b401d98f5757ebe97a26085998d6c0eecec4995cad6ab7fc30ffdf4b052843" +checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" dependencies = [ "pest", "pest_meta", @@ -3652,9 +3615,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.8.3" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f27a2cfee9f9039c4d86faa5af122a0ac3851441a34865b8a043b46be0065a" +checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" dependencies = [ "pest", "sha2", @@ -3944,9 +3907,9 @@ dependencies = [ [[package]] name = "prost-reflect" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89a3ac73ec9a9118131a4594c9d336631a07852220a1d0ae03ee36b04503a063" +checksum = "b89455ef41ed200cafc47c76c552ee7792370ac420497e551f16123a9135f76e" dependencies = [ "logos 0.15.1", "miette", @@ -3989,14 +3952,14 @@ dependencies = [ [[package]] name = "protox" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8555716f64c546306ddf3383065dc40d4232609e79e0a4c50e94e87d54f30fb4" +checksum = "4f25a07a73c6717f0b9bbbd685918f5df9815f7efba450b83d9c9dea41f0e3a1" dependencies = [ "bytes", "miette", "prost 0.14.1", - "prost-reflect 0.16.2", + "prost-reflect 0.16.3", "prost-types 0.14.1", "protox-parse 0.9.0", "thiserror 2.0.17", @@ -4341,9 +4304,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" +checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" dependencies = [ "zeroize", ] @@ -4621,9 +4584,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.6" +version = "1.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" dependencies = [ "libc", ] @@ -4640,9 +4603,9 @@ dependencies = [ [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "similar" @@ -4796,9 +4759,9 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "syn" -version = "2.0.110" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -4863,9 +4826,9 @@ dependencies = [ [[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.61.2", ] @@ -5123,9 +5086,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.23.7" +version = "0.23.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" dependencies = [ "indexmap", "serde_core", @@ -5297,9 +5260,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[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", @@ -5308,9 +5271,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -5319,9 +5282,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", "valuable", @@ -5340,9 +5303,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "matchers", "nu-ansi-term", @@ -5499,9 +5462,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.18.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" dependencies = [ "getrandom 0.3.4", "js-sys", @@ -5580,9 +5543,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" dependencies = [ "cfg-if", "once_cell", @@ -5593,9 +5556,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.55" +version = "0.4.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" +checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" dependencies = [ "cfg-if", "js-sys", @@ -5606,9 +5569,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5616,9 +5579,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" dependencies = [ "bumpalo", "proc-macro2", @@ -5629,9 +5592,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" dependencies = [ "unicode-ident", ] @@ -5648,12 +5611,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.241.2" +version = "0.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01164c9dda68301e34fdae536c23ed6fe90ce6d97213ccc171eebbd3d02d6b8" +checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" dependencies = [ "leb128fmt", - "wasmparser 0.241.2", + "wasmparser 0.243.0", ] [[package]] @@ -5706,9 +5669,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.241.2" +version = "0.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46d90019b1afd4b808c263e428de644f3003691f243387d30d673211ee0cb8e8" +checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d" dependencies = [ "bitflags", "indexmap", @@ -5728,31 +5691,31 @@ dependencies = [ [[package]] name = "wast" -version = "241.0.2" +version = "243.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f66e07e2ddf531fef6344dbf94d112df7c2f23ed6ffb10962e711500b8d816" +checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.0", - "wasm-encoder 0.241.2", + "wasm-encoder 0.243.0", ] [[package]] name = "wat" -version = "1.241.2" +version = "1.243.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f923705c40830af909c5dec2352ec2821202e4a66008194585e1917458a26d" +checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.82" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" +checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" dependencies = [ "js-sys", "wasm-bindgen", @@ -6170,9 +6133,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" dependencies = [ "memchr", ] @@ -6393,18 +6356,18 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" -version = "0.8.28" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.28" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index b87cb4de8..45e094c1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ exclude = [ [workspace.package] version = "0.5.1" -rust-version = "1.90" +rust-version = "1.92" authors = ["Miden contributors"] description = "An intermediate representation and compiler for Miden Assembly" repository = "https://github.com/0xMiden/compiler" @@ -45,7 +45,7 @@ publish = false anyhow = { version = "1.0", default-features = false } bitflags = "2.4" bitvec = { version = "1.0", default-features = false, features = ["alloc"] } -blink-alloc = { version = "0.3", default-features = false, features = [ +blink-alloc = { version = "0.4", default-features = false, features = [ "alloc", "nightly", ] } @@ -61,10 +61,6 @@ cranelift-entity = "0.120" compact_str = { version = "0.9", default-features = false } env_logger = "0.11" hashbrown = { version = "0.15", features = ["nightly"] } -hashbrown_old_nightly_hack = { package = "hashbrown", version = "0.14.5", features = [ - "allocator-api2", - "nightly", -] } Inflector = "0.11" intrusive-collections = "0.9" inventory = "0.3" @@ -245,7 +241,7 @@ opt-level = 3 [profile.test.package.midenc-session] opt-level = 3 -[profile.test.package.midenc-debug] +[profile.test.package.miden-debug] opt-level = 3 # ============================================================ diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 6372def62..8749423e9 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -19,7 +19,7 @@ anyhow.workspace = true clap.workspace = true [dev-dependencies] -criterion = "0.5" +criterion = "0.8" [[bench]] name = "is_prime_bench" diff --git a/benches/benches/is_prime_bench.rs b/benches/benches/is_prime_bench.rs index 2b56a04b1..488c6450a 100644 --- a/benches/benches/is_prime_bench.rs +++ b/benches/benches/is_prime_bench.rs @@ -2,9 +2,9 @@ //! //! This provides detailed performance analysis using the Criterion benchmarking framework. -use std::path::PathBuf; +use std::{hint::black_box, path::PathBuf}; -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{criterion_group, criterion_main, Criterion}; use midenc_benchmark_runner::BenchmarkRunner; fn bench_is_prime_compilation(c: &mut Criterion) { diff --git a/codegen/masm/src/artifact.rs b/codegen/masm/src/artifact.rs index c29c6415b..47c8b79c2 100644 --- a/codegen/masm/src/artifact.rs +++ b/codegen/masm/src/artifact.rs @@ -95,14 +95,13 @@ impl Rodata { let mut felts = Vec::with_capacity(bytes.len() / 4); let mut iter = bytes.iter().copied().array_chunks::<4>(); felts.extend(iter.by_ref().map(|chunk| Felt::new(u32::from_le_bytes(chunk) as u64))); - if let Some(remainder) = iter.into_remainder() { - if remainder.len() > 0 { - let mut chunk = [0u8; 4]; - for (i, byte) in remainder.into_iter().enumerate() { - chunk[i] = byte; - } - felts.push(Felt::new(u32::from_le_bytes(chunk) as u64)); + let remainder = iter.into_remainder(); + if remainder.len() > 0 { + let mut chunk = [0u8; 4]; + for (i, byte) in remainder.enumerate() { + chunk[i] = byte; } + felts.push(Felt::new(u32::from_le_bytes(chunk) as u64)); } let size_in_felts = bytes.len().next_multiple_of(4) / 4; diff --git a/codegen/masm/src/lib.rs b/codegen/masm/src/lib.rs index 846a88086..997989a92 100644 --- a/codegen/masm/src/lib.rs +++ b/codegen/masm/src/lib.rs @@ -1,7 +1,5 @@ #![feature(debug_closure_helpers)] #![feature(assert_matches)] -#![feature(const_type_id)] -#![feature(array_chunks)] #![feature(iter_array_chunks)] #![feature(iterator_try_collect)] #![deny(warnings)] diff --git a/eval/src/evaluator/frame.rs b/eval/src/evaluator/frame.rs index d9dff2d70..0b7ac8699 100644 --- a/eval/src/evaluator/frame.rs +++ b/eval/src/evaluator/frame.rs @@ -1,3 +1,5 @@ +#![expect(unused_assignments)] + use alloc::{format, vec}; use midenc_hir::{ diff --git a/eval/src/evaluator/memory.rs b/eval/src/evaluator/memory.rs index b74e0f83a..2dfb0eaa2 100644 --- a/eval/src/evaluator/memory.rs +++ b/eval/src/evaluator/memory.rs @@ -1,3 +1,5 @@ +#![expect(unused_assignments)] + use alloc::{format, string::String, vec, vec::Vec}; use core::ops::{Index, IndexMut, Range}; diff --git a/hir-symbol/Cargo.toml b/hir-symbol/Cargo.toml index 8350e23c9..8a050d333 100644 --- a/hir-symbol/Cargo.toml +++ b/hir-symbol/Cargo.toml @@ -27,7 +27,6 @@ serde = { workspace = true, optional = true } [build-dependencies] Inflector.workspace = true hashbrown.workspace = true -hashbrown_old_nightly_hack.workspace = true rustc-hash.workspace = true toml.workspace = true diff --git a/hir/Cargo.toml b/hir/Cargo.toml index ad729b366..ba81a4967 100644 --- a/hir/Cargo.toml +++ b/hir/Cargo.toml @@ -23,7 +23,6 @@ bitflags.workspace = true blink-alloc.workspace = true compact_str.workspace = true hashbrown.workspace = true -hashbrown_old_nightly_hack.workspace = true intrusive-collections.workspace = true inventory.workspace = true log.workspace = true diff --git a/hir/src/adt/smalldeque.rs b/hir/src/adt/smalldeque.rs index 62c24b485..ad0ad847b 100644 --- a/hir/src/adt/smalldeque.rs +++ b/hir/src/adt/smalldeque.rs @@ -1815,7 +1815,7 @@ impl From> for SmallVec<[T; N]> { // SmallVec's inline size, "move" `len` items into it, and the construct the // SmallVec from the raw buffer and len let mut buf = [const { core::mem::MaybeUninit::::uninit() }; N]; - let buf_ptr = core::mem::MaybeUninit::slice_as_mut_ptr(&mut buf); + let buf_ptr = buf.as_mut_ptr().cast_init(); ptr::copy(ptr.add(other.head), buf_ptr, len); // While we are technically potentially letting a subset of elements in the // array that never got uninitialized, be assumed to have been initialized diff --git a/hir/src/ir/region.rs b/hir/src/ir/region.rs index 3915da1f3..61676e405 100644 --- a/hir/src/ir/region.rs +++ b/hir/src/ir/region.rs @@ -5,7 +5,7 @@ mod kind; mod successor; mod transforms; -use smallvec::{smallvec, SmallVec}; +use smallvec::SmallVec; pub use self::{ branch_point::RegionBranchPoint, diff --git a/hir/src/ir/symbols.rs b/hir/src/ir/symbols.rs index db68699fa..74ec6f22f 100644 --- a/hir/src/ir/symbols.rs +++ b/hir/src/ir/symbols.rs @@ -1,3 +1,5 @@ +#![expect(unused_assignments)] + mod name; mod path; mod symbol; diff --git a/hir/src/ir/value/range.rs b/hir/src/ir/value/range.rs index c72e544d9..1d8b8e1a4 100644 --- a/hir/src/ir/value/range.rs +++ b/hir/src/ir/value/range.rs @@ -14,8 +14,10 @@ use crate::adt::SmallSet; /// /// In general, this should be used in only narrow circumstances where a more specific range type /// cannot be used. +#[derive(Default)] pub enum ValueRange<'a, const N: usize = 2> { /// A default-initialized empty range + #[default] Empty, /// The values in the range are type-erased, but owned Owned(SmallVec<[ValueRef; N]>), @@ -29,12 +31,6 @@ pub enum ValueRange<'a, const N: usize = 2> { Results(&'a [OpResultRef]), } -impl Default for ValueRange<'_, N> { - fn default() -> Self { - Self::Empty - } -} - impl<'values, const N: usize> ValueRange<'values, N> { /// Returns true if this range is empty pub fn is_empty(&self) -> bool { diff --git a/hir/src/lib.rs b/hir/src/lib.rs index 51f0af058..fbf0e6f25 100644 --- a/hir/src/lib.rs +++ b/hir/src/lib.rs @@ -17,7 +17,6 @@ #![feature(fn_traits)] #![feature(unboxed_closures)] #![feature(box_into_inner)] -#![feature(const_type_id)] #![feature(exact_size_is_empty)] #![feature(generic_const_exprs)] #![feature(clone_to_uninit)] @@ -31,7 +30,7 @@ #![feature(iter_collect_into)] #![feature(trusted_len)] #![feature(never_type)] -#![feature(maybe_uninit_slice)] +#![feature(cast_maybe_uninit)] #![feature(maybe_uninit_array_assume_init)] #![feature(maybe_uninit_uninit_array_transpose)] #![feature(array_into_iter_constructors)] diff --git a/midenc-compile/Cargo.toml b/midenc-compile/Cargo.toml index 470c0bd0f..5ee330626 100644 --- a/midenc-compile/Cargo.toml +++ b/midenc-compile/Cargo.toml @@ -26,7 +26,6 @@ std = [ ] [dependencies] -anyhow.workspace = true clap = { workspace = true, optional = true } log.workspace = true inventory.workspace = true diff --git a/midenc-session/src/diagnostics.rs b/midenc-session/src/diagnostics.rs index ee15c6598..eb1f21d83 100644 --- a/midenc-session/src/diagnostics.rs +++ b/midenc-session/src/diagnostics.rs @@ -1,3 +1,5 @@ +#![expect(unused_assignments)] + use alloc::{ boxed::Box, collections::BTreeMap, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 79c890449..18e1e56f9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,7 +2,7 @@ # REMINDER: After updating the channel, update: # - docs/src/usage/cargo-miden.md # - docs/src/usage/midenc.md -channel = "nightly-2025-07-20" -components = ["rustfmt", "rust-src", "clippy"] +channel = "nightly-2025-12-10" +components = ["rustfmt", "rust-src", "clippy", "rust-analyzer"] targets = ["wasm32-unknown-unknown", "wasm32-wasip1", "wasm32-wasip2"] profile = "minimal" diff --git a/tests/integration/src/testing/eval.rs b/tests/integration/src/testing/eval.rs index c0a6b1f56..1b2ef43fa 100644 --- a/tests/integration/src/testing/eval.rs +++ b/tests/integration/src/testing/eval.rs @@ -64,15 +64,14 @@ where word.reverse(); buf.push(word); } - if let Some(remainder) = words.into_remainder().filter(|r| r.len() > 0) { - if remainder.len() > 0 { - let mut word = [Felt::ZERO; 4]; - for (i, felt) in remainder.enumerate() { - word[i] = felt; - } - word.reverse(); - buf.push(word); + let remainder = words.into_remainder(); + if remainder.len() > 0 { + let mut word = [Felt::ZERO; 4]; + for (i, felt) in remainder.enumerate() { + word[i] = felt; } + word.reverse(); + buf.push(word); } for word in buf.into_iter().rev() { for felt in word.into_iter() { diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock index f2b291770..314dbafc1 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock @@ -151,9 +151,9 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64ct" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" [[package]] name = "bech32" @@ -1095,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0048d2d987f215bc9633ced499a8c488d0e2474350c765f904b87cae3462acb7" +checksum = "395e5cc76b64e24533ee55c8d1ff90305b8cad372bdbea4f4f324239e36a895f" dependencies = [ "blake3", "cc", @@ -1125,9 +1125,9 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3b38aace84e157fb02aba8f8ae85bbf8c3afdcdbdf8190fbe7476f3be7ef44" +checksum = "c89641b257eb395cf03105ac1c6cbdf3fd9a5450749696af9835c3c47fc6806e" dependencies = [ "quote", "syn", diff --git a/tools/cargo-miden/Cargo.toml b/tools/cargo-miden/Cargo.toml index c912ad3dc..ef79ec0e1 100644 --- a/tools/cargo-miden/Cargo.toml +++ b/tools/cargo-miden/Cargo.toml @@ -34,7 +34,6 @@ serde.workspace = true serde_json = "1.0" toml_edit = { version = "0.23", features = ["serde"] } semver.workspace = true -parse_arg = "0.1.6" liquid = "0.26" tempfile = "3.19" walkdir = "2.5" diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index 51e324a44..7f1866495 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -200,7 +200,7 @@ fn build_cargo_args(cargo_opts: &CargoOptions) -> Vec { "-Z", "build-std=std,core,alloc,panic_abort", "-Z", - "build-std-features=panic_immediate_abort", + "unstable-options -Cpanic=immediate-abort", ] .into_iter() .map(|s| s.to_string()), From 5a29b314d06addd38851af9421e63fb6c77b5f5e Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Sun, 14 Dec 2025 13:53:44 -0500 Subject: [PATCH 56/70] fix: rust-lld fails due to divergent definitions of __rdl_alloc_error_handler It appears that Rust for the wasm32-* targets now emits a second object file containing stub definitions for the default #[alloc_error_handler] that is defined by liballoc/libstd (the implementations are different depending on whether a crate is #![no_std] or not). The problem is that the signature of these stubs does not match the signature of the actual definitions, i.e. it is `fn() -> !` rather than `fn(core::alloc::Layout) -> !`. Because these stubs are fed to rust-lld, we get conflicting symbol errors due to the stub definition conflicting with the actual definition in liballoc. It isn't clear to me why this second object file is emitted by Rust, nor why the signature is wrong. My assumption is that it has something to do with the fact that we're producing a `cdylib` artifact, or perhaps due to our use of `cargo -Zbuild-std` (more likely), but I wasn't able to confirm either option. Regardless, the fix appears to be to ensure that we define our own `#[alloc_error_handler]` with the correct signature in the crate being compiled. This ensures that only one definition is present, ours, and makes the conflict go away. The downside of this (currently), is that it also requires activation of `#[feature(alloc_error_handler)]`, which cannot be hidden by our proc-macro machinery that hides boilerplate. My hope is that we can figure out the actual underlying issue here, or a fix is shipped in a new nightly and we can make this workaround go away. --- docs/external/src/usage/cargo-miden.md | 2 +- docs/external/src/usage/midenc.md | 2 +- examples/auth-component-no-auth/src/lib.rs | 1 + .../rust-toolchain.toml | 3 +- .../auth-component-rpo-falcon512/src/lib.rs | 4 +- .../rust-toolchain.toml | 2 +- examples/basic-wallet-tx-script/src/lib.rs | 1 + examples/basic-wallet/rust-toolchain.toml | 2 +- examples/basic-wallet/src/lib.rs | 3 +- examples/collatz/rust-toolchain.toml | 2 +- examples/collatz/src/lib.rs | 7 +++ examples/counter-contract/rust-toolchain.toml | 2 +- examples/counter-contract/src/lib.rs | 3 +- examples/counter-note/rust-toolchain.toml | 2 +- examples/counter-note/src/lib.rs | 1 + examples/fibonacci/rust-toolchain.toml | 2 +- examples/fibonacci/src/lib.rs | 9 +++- examples/is-prime/rust-toolchain.toml | 2 +- examples/is-prime/src/lib.rs | 7 +++ examples/p2id-note/rust-toolchain.toml | 2 +- examples/p2id-note/src/lib.rs | 1 + examples/p2ide-note/rust-toolchain.toml | 2 +- examples/p2ide-note/src/lib.rs | 1 + examples/storage-example/rust-toolchain.toml | 2 +- examples/storage-example/src/lib.rs | 3 +- sdk/alloc/build.rs | 2 - sdk/base-macros/src/boilerplate.rs | 16 ++++++ sdk/base-sys/build.rs | 2 - sdk/stdlib-sys/build.rs | 4 -- tests/integration/src/compiler_test.rs | 30 +++++++++-- tests/integration/src/rust_masm_tests/apps.rs | 21 ++++++++ .../rust_masm_tests/rust_sdk/base/account.rs | 1 + .../rust_masm_tests/rust_sdk/base/asset.rs | 1 + .../rust_masm_tests/rust_sdk/base/faucet.rs | 1 + .../rust_sdk/base/input_note.rs | 1 + .../src/rust_masm_tests/rust_sdk/base/note.rs | 1 + .../rust_sdk/base/output_note.rs | 1 + .../src/rust_masm_tests/rust_sdk/base/tx.rs | 1 + .../src/rust_masm_tests/rust_sdk/mod.rs | 1 + .../rust-sdk/account-test/src/lib.rs | 3 ++ tests/rust-apps-wasm/rust-sdk/add/src/lib.rs | 7 +++ .../component-macros-account/src/lib.rs | 5 +- .../rust-sdk/component-macros-note/src/lib.rs | 3 +- .../cross-ctx-account-word-arg/src/lib.rs | 8 +++ .../cross-ctx-account-word/src/lib.rs | 10 +++- .../rust-sdk/cross-ctx-account/src/lib.rs | 8 +++ .../cross-ctx-note-word-arg/src/lib.rs | 8 +++ .../rust-sdk/cross-ctx-note-word/src/lib.rs | 8 +++ .../rust-sdk/cross-ctx-note/src/lib.rs | 8 +++ tools/cargo-miden/src/commands/build.rs | 51 ++++++++----------- 50 files changed, 204 insertions(+), 66 deletions(-) diff --git a/docs/external/src/usage/cargo-miden.md b/docs/external/src/usage/cargo-miden.md index 944da6b7d..c8668d481 100644 --- a/docs/external/src/usage/cargo-miden.md +++ b/docs/external/src/usage/cargo-miden.md @@ -17,7 +17,7 @@ Currently, `midenc` (and as a result, `cargo-miden`), requires the nightly Rust make sure you have it installed first: ```bash -rustup toolchain install nightly-2025-07-20 +rustup toolchain install nightly-2025-12-10 ``` NOTE: You can also use the latest nightly, but the specific nightly shown here is known to diff --git a/docs/external/src/usage/midenc.md b/docs/external/src/usage/midenc.md index 3fdab5b19..ca8ec1c2d 100644 --- a/docs/external/src/usage/midenc.md +++ b/docs/external/src/usage/midenc.md @@ -22,7 +22,7 @@ Currently, `midenc` (and as a result, `cargo-miden`), requires the nightly Rust make sure you have it installed first: ```bash -rustup toolchain install nightly-2025-07-20 +rustup toolchain install nightly-2025-12-10 ``` NOTE: You can also use the latest nightly, but the specific nightly shown here is known to diff --git a/examples/auth-component-no-auth/src/lib.rs b/examples/auth-component-no-auth/src/lib.rs index f19bf52bc..ac1fb34dc 100644 --- a/examples/auth-component-no-auth/src/lib.rs +++ b/examples/auth-component-no-auth/src/lib.rs @@ -1,5 +1,6 @@ // 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: diff --git a/examples/auth-component-rpo-falcon512/rust-toolchain.toml b/examples/auth-component-rpo-falcon512/rust-toolchain.toml index 8e58f5be6..d9d7c02f0 100644 --- a/examples/auth-component-rpo-falcon512/rust-toolchain.toml +++ b/examples/auth-component-rpo-falcon512/rust-toolchain.toml @@ -1,6 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" - diff --git a/examples/auth-component-rpo-falcon512/src/lib.rs b/examples/auth-component-rpo-falcon512/src/lib.rs index 32c96ae35..3ce7a8a57 100644 --- a/examples/auth-component-rpo-falcon512/src/lib.rs +++ b/examples/auth-component-rpo-falcon512/src/lib.rs @@ -1,9 +1,11 @@ #![no_std] +#![feature(alloc_error_handler)] extern crate alloc; use miden::{ - component, felt, hash_words, intrinsics::advice::adv_insert, tx, Felt, Value, ValueAccess, Word, + component, felt, hash_words, intrinsics::advice::adv_insert, native_account, tx, Felt, Value, + ValueAccess, Word, }; /// Authentication component storage/layout. diff --git a/examples/basic-wallet-tx-script/rust-toolchain.toml b/examples/basic-wallet-tx-script/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/basic-wallet-tx-script/rust-toolchain.toml +++ b/examples/basic-wallet-tx-script/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/basic-wallet-tx-script/src/lib.rs b/examples/basic-wallet-tx-script/src/lib.rs index c0cd4a5d0..352dd3995 100644 --- a/examples/basic-wallet-tx-script/src/lib.rs +++ b/examples/basic-wallet-tx-script/src/lib.rs @@ -1,5 +1,6 @@ // 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: diff --git a/examples/basic-wallet/rust-toolchain.toml b/examples/basic-wallet/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/basic-wallet/rust-toolchain.toml +++ b/examples/basic-wallet/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/basic-wallet/src/lib.rs b/examples/basic-wallet/src/lib.rs index e3a3e0b43..a77754667 100644 --- a/examples/basic-wallet/src/lib.rs +++ b/examples/basic-wallet/src/lib.rs @@ -1,12 +1,13 @@ // 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::{component, output_note, Asset, NoteIdx}; +use miden::{component, native_account, output_note, Asset, NoteIdx}; #[component] struct MyAccount; diff --git a/examples/collatz/rust-toolchain.toml b/examples/collatz/rust-toolchain.toml index fcfe53298..777721eab 100644 --- a/examples/collatz/rust-toolchain.toml +++ b/examples/collatz/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src"] targets = ["wasm32-wasip1"] profile = "minimal" diff --git a/examples/collatz/src/lib.rs b/examples/collatz/src/lib.rs index 9d1d14883..af26ce898 100644 --- a/examples/collatz/src/lib.rs +++ b/examples/collatz/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -18,6 +19,12 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +#[cfg(not(test))] +#[alloc_error_handler] +fn alloc_failed(_layout: core::alloc::Layout) -> ! { + loop {} +} + // Pass up to 16 u32 inputs as entrypoint function parameters. // The output is temporarely limited to 1 u32 value // diff --git a/examples/counter-contract/rust-toolchain.toml b/examples/counter-contract/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/counter-contract/rust-toolchain.toml +++ b/examples/counter-contract/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/counter-contract/src/lib.rs b/examples/counter-contract/src/lib.rs index d3dcce261..5567f44e0 100644 --- a/examples/counter-contract/src/lib.rs +++ b/examples/counter-contract/src/lib.rs @@ -1,12 +1,13 @@ // 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::{component, felt, Felt, StorageMap, StorageMapAccess, Word}; +use miden::{Felt, StorageMap, StorageMapAccess, Word, component, felt}; /// Main contract structure for the counter example. #[component] diff --git a/examples/counter-note/rust-toolchain.toml b/examples/counter-note/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/counter-note/rust-toolchain.toml +++ b/examples/counter-note/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/counter-note/src/lib.rs b/examples/counter-note/src/lib.rs index 8c2ae6f5a..ac1f931b3 100644 --- a/examples/counter-note/src/lib.rs +++ b/examples/counter-note/src/lib.rs @@ -1,5 +1,6 @@ // 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: diff --git a/examples/fibonacci/rust-toolchain.toml b/examples/fibonacci/rust-toolchain.toml index fcfe53298..777721eab 100644 --- a/examples/fibonacci/rust-toolchain.toml +++ b/examples/fibonacci/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src"] targets = ["wasm32-wasip1"] profile = "minimal" diff --git a/examples/fibonacci/src/lib.rs b/examples/fibonacci/src/lib.rs index 55a9dbe79..df0fea6bf 100644 --- a/examples/fibonacci/src/lib.rs +++ b/examples/fibonacci/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -12,12 +13,18 @@ // static ALLOC: BumpAlloc = miden::BumpAlloc::new(); // Required for no-std crates -#[panic_handler] #[cfg(not(test))] +#[panic_handler] fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +#[cfg(not(test))] +#[alloc_error_handler] +fn alloc_failed(_layout: core::alloc::Layout) -> ! { + loop {} +} + // Pass up to 16 u32 inputs as entrypoint function parameters. // The output is temporarely limited to 1 u32 value // diff --git a/examples/is-prime/rust-toolchain.toml b/examples/is-prime/rust-toolchain.toml index fcfe53298..777721eab 100644 --- a/examples/is-prime/rust-toolchain.toml +++ b/examples/is-prime/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src"] targets = ["wasm32-wasip1"] profile = "minimal" diff --git a/examples/is-prime/src/lib.rs b/examples/is-prime/src/lib.rs index f3d922353..9073b5214 100644 --- a/examples/is-prime/src/lib.rs +++ b/examples/is-prime/src/lib.rs @@ -1,4 +1,5 @@ #![no_std] +#![feature(alloc_error_handler)] #[cfg(not(test))] #[panic_handler] @@ -6,6 +7,12 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +#[cfg(not(test))] +#[alloc_error_handler] +fn alloc_failed(_layout: core::alloc::Layout) -> ! { + loop {} +} + /// Returns 1 if integer is prime fn is_prime(n: u32) -> bool { if n <= 1 { diff --git a/examples/p2id-note/rust-toolchain.toml b/examples/p2id-note/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/p2id-note/rust-toolchain.toml +++ b/examples/p2id-note/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index dc3c31048..73a0d4d55 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -1,5 +1,6 @@ // 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: diff --git a/examples/p2ide-note/rust-toolchain.toml b/examples/p2ide-note/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/p2ide-note/rust-toolchain.toml +++ b/examples/p2ide-note/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index 37bd901fa..955ad649e 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -1,5 +1,6 @@ // 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: diff --git a/examples/storage-example/rust-toolchain.toml b/examples/storage-example/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/storage-example/rust-toolchain.toml +++ b/examples/storage-example/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/storage-example/src/lib.rs b/examples/storage-example/src/lib.rs index b05ecad52..563f7d208 100644 --- a/examples/storage-example/src/lib.rs +++ b/examples/storage-example/src/lib.rs @@ -1,12 +1,13 @@ // 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::{component, Asset, Felt, StorageMap, StorageMapAccess, Value, ValueAccess, Word}; +use miden::{Asset, Felt, StorageMap, StorageMapAccess, Value, ValueAccess, Word, component}; use crate::bindings::exports::miden::storage_example::*; diff --git a/sdk/alloc/build.rs b/sdk/alloc/build.rs index a9287caab..4dd8fda21 100644 --- a/sdk/alloc/build.rs +++ b/sdk/alloc/build.rs @@ -47,8 +47,6 @@ fn main() { .arg("-C") .arg("opt-level=1") .arg("-C") - .arg("panic=abort") - .arg("-C") .arg("codegen-units=1") .arg("-C") .arg("debuginfo=0") diff --git a/sdk/base-macros/src/boilerplate.rs b/sdk/base-macros/src/boilerplate.rs index 9f4f82ab4..bbd301d43 100644 --- a/sdk/base-macros/src/boilerplate.rs +++ b/sdk/base-macros/src/boilerplate.rs @@ -13,6 +13,22 @@ pub(crate) fn runtime_boilerplate() -> TokenStream2 { #[panic_handler] #[allow(clippy::empty_loop)] fn __miden_runtime_panic_handler(_info: &::core::panic::PanicInfo) -> ! { + #[cfg(target_family = "wasm")] + core::arch::wasm32::unreachable(); + + #[cfg(not(target_family = "wasm"))] + loop {} + } + + #[cfg(not(test))] + #[doc = "Allocation error handler used when building for Miden VM"] + #[alloc_error_handler] + #[allow(clippy::empty_loop)] + fn __miden_runtime_alloc_error_handler(_layout: ::core::alloc::Layout) -> ! { + #[cfg(target_family = "wasm")] + core::arch::wasm32::unreachable(); + + #[cfg(not(target_family = "wasm"))] loop {} } } diff --git a/sdk/base-sys/build.rs b/sdk/base-sys/build.rs index cbfeced69..a98c91dd9 100644 --- a/sdk/base-sys/build.rs +++ b/sdk/base-sys/build.rs @@ -85,8 +85,6 @@ fn main() { .arg("-C") .arg("opt-level=1") .arg("-C") - .arg("panic=abort") - .arg("-C") .arg("codegen-units=1") .arg("-C") .arg("debuginfo=0") diff --git a/sdk/stdlib-sys/build.rs b/sdk/stdlib-sys/build.rs index 6aaecad41..603bff469 100644 --- a/sdk/stdlib-sys/build.rs +++ b/sdk/stdlib-sys/build.rs @@ -91,8 +91,6 @@ fn main() { .arg("-C") .arg("opt-level=1") .arg("-C") - .arg("panic=abort") - .arg("-C") .arg("codegen-units=1") .arg("-C") .arg("debuginfo=0") @@ -120,8 +118,6 @@ fn main() { .arg("-C") .arg("opt-level=1") .arg("-C") - .arg("panic=abort") - .arg("-C") .arg("codegen-units=1") .arg("-C") .arg("debuginfo=0") diff --git a/tests/integration/src/compiler_test.rs b/tests/integration/src/compiler_test.rs index e94a4bb79..41ee9786f 100644 --- a/tests/integration/src/compiler_test.rs +++ b/tests/integration/src/compiler_test.rs @@ -193,6 +193,9 @@ impl CompilerTestBuilder { // Enable bulk-memory features (e.g. native memcpy/memset instructions) "-C".into(), "target-feature=+bulk-memory,+wide-arithmetic".into(), + // Compile with panic=immediate-abort to avoid emitting any panic formatting code + "-C".into(), + "panic=immediate-abort".into(), // Remap the compiler workspace to `.` so that build outputs do not embed user- // specific paths, which would cause expect tests to break "--remap-path-prefix".into(), @@ -509,13 +512,20 @@ impl CompilerTestBuilder { r#" #![no_std] #![no_main] + #![feature(alloc_error_handler)] #[panic_handler] fn my_panic(_info: &core::panic::PanicInfo) -> ! {{ core::arch::wasm32::unreachable() }} - #[no_mangle] + #[alloc_error_handler] + fn my_alloc_error(_info: core::alloc::Layout) -> ! {{ + core::arch::wasm32::unreachable() + }} + + + #[unsafe(no_mangle)] pub extern "C" fn entrypoint{rust_source} "# ); @@ -577,23 +587,28 @@ impl CompilerTestBuilder { r#" #![no_std] #![no_main] + #![feature(alloc_error_handler)] #![allow(unused_imports)] + extern crate alloc; + + #[alloc_error_handler] + fn alloc_error(_layout: core::alloc::Layout) -> ! {{ + core::arch::wasm32::unreachable() + }} + #[panic_handler] fn my_panic(_info: &core::panic::PanicInfo) -> ! {{ core::arch::wasm32::unreachable() }} - #[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; - - #[no_mangle] + #[unsafe(no_mangle)] #[allow(improper_ctypes_definitions)] pub extern "C" fn entrypoint{source} "# @@ -651,6 +666,7 @@ impl CompilerTestBuilder { format!( r#"#![no_std] #![no_main] +#![feature(alloc_error_handler)] #![allow(unused_imports)] #[panic_handler] @@ -658,6 +674,10 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! {{ core::arch::wasm32::unreachable() }} +#[alloc_error_handler] +fn alloc_error(_layout: core::alloc::Layout) -> ! {{ + core::arch::wasm32::unreachable() +}} #[global_allocator] static ALLOC: miden_sdk_alloc::BumpAlloc = miden_sdk_alloc::BumpAlloc::new(); diff --git a/tests/integration/src/rust_masm_tests/apps.rs b/tests/integration/src/rust_masm_tests/apps.rs index 167718c1e..e629b0911 100644 --- a/tests/integration/src/rust_masm_tests/apps.rs +++ b/tests/integration/src/rust_masm_tests/apps.rs @@ -56,6 +56,7 @@ fn function_call_hir2() { "src/lib.rs", r#" #![no_std] + #![feature(alloc_error_handler)] // Global allocator to use heap memory in no-std environment // #[global_allocator] @@ -67,6 +68,12 @@ fn function_call_hir2() { loop {} } + // Required for no-std crates + #[alloc_error_handler] + fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} + } + // use miden::Felt; #[no_mangle] @@ -103,6 +110,7 @@ fn mem_intrinsics_heap_base() { "src/lib.rs", r#" #![no_std] + #![feature(alloc_error_handler)] // Global allocator to use heap memory in no-std environment #[global_allocator] @@ -114,6 +122,12 @@ fn mem_intrinsics_heap_base() { loop {} } + // Required for no-std crates + #[alloc_error_handler] + fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} + } + extern crate alloc; use alloc::{vec, vec::Vec}; @@ -145,6 +159,7 @@ fn felt_intrinsics() { "src/lib.rs", r#" #![no_std] + #![feature(alloc_error_handler)] // Required for no-std crates #[panic_handler] @@ -152,6 +167,12 @@ fn felt_intrinsics() { loop {} } + // Required for no-std crates + #[alloc_error_handler] + fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} + } + // Global allocator to use heap memory in no-std environment #[global_allocator] static ALLOC: miden::BumpAlloc = miden::BumpAlloc::new(); 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 4b7274036..c8f132881 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 @@ -4,6 +4,7 @@ use super::*; fn run_account_binding_test(name: &str, method: &str) { let lib_rs = format!( r"#![no_std] +#![feature(alloc_error_handler)] use miden::*; diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs index 447182040..e29998157 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs @@ -4,6 +4,7 @@ use super::*; fn run_asset_binding_test(name: &str, method: &str) { let lib_rs = format!( r"#![no_std] +#![feature(alloc_error_handler)] use miden::*; diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs index c38e2e7bd..79a23744a 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs @@ -4,6 +4,7 @@ use super::*; fn run_faucet_binding_test(name: &str, method: &str) { let lib_rs = format!( r"#![no_std] +#![feature(alloc_error_handler)] use miden::*; 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 1744cc916..71d17e220 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 @@ -4,6 +4,7 @@ use super::*; fn run_input_note_binding_test(name: &str, method: &str) { let lib_rs = format!( r"#![no_std] +#![feature(alloc_error_handler)] use miden::*; 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 index 7a7a95e11..41d0fb271 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs @@ -4,6 +4,7 @@ use super::*; fn run_note_binding_test(name: &str, body: &str) { let lib_rs = format!( r"#![no_std] +#![feature(alloc_error_handler)] use miden::*; 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 659e52550..1a3a0afe3 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 @@ -4,6 +4,7 @@ use super::*; fn run_output_note_binding_test(name: &str, method: &str) { let lib_rs = format!( r"#![no_std] +#![feature(alloc_error_handler)] use miden::*; diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs index 326ad3726..4a9e9df09 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs @@ -4,6 +4,7 @@ use super::*; fn run_tx_binding_test(name: &str, body: &str) { let lib_rs = format!( r"#![no_std] +#![feature(alloc_error_handler)] use miden::*; 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 fc0b5036d..5f92c14db 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -94,6 +94,7 @@ debug = false ); let lib_rs = r#"#![no_std] +#![feature(alloc_error_handler)] use miden::*; 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 index fa1d186b8..48e7b6696 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs @@ -1,3 +1,6 @@ +#![no_std] +#![feature(alloc_error_handler)] + extern crate alloc; use miden::*; diff --git a/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs index dade07487..df43314f1 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs @@ -1,5 +1,6 @@ // Do not link against libstd (i.e. anything defined in `std::`) #![no_std] +#![feature(alloc_error_handler)] // Global allocator to use heap memory in no-std environment #[global_allocator] @@ -11,6 +12,12 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +// Required for no-std crates +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + // use miden::Felt; #[no_mangle] diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs index ab194adf1..353e82912 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs @@ -1,9 +1,10 @@ #![no_std] +#![feature(alloc_error_handler)] -use miden::{component, export_type, Asset, Felt, Word}; +use miden::{Asset, Felt, Word, component, export_type}; pub mod my_types { - use miden::{export_type, Felt}; + use miden::{Felt, export_type}; #[export_type] pub enum EnumA { 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 ec52d0318..98a31d169 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 @@ -1,9 +1,10 @@ #![no_std] +#![feature(alloc_error_handler)] use miden::*; use crate::bindings::miden::component_macros_account::component_macros_account::{ - test_custom_types, StructA, StructB, + StructA, StructB, test_custom_types, }; #[note_script] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs index 1481358ee..028dec1b2 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -18,6 +19,13 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +// Required for no-std crates +#[cfg(not(test))] +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + use miden::*; miden::generate!(); diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs index 396292a1b..643aa2f90 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -18,13 +19,20 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +// Required for no-std crates +#[cfg(not(test))] +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + use bindings::exports::miden::cross_ctx_account_word::*; miden::generate!(); bindings::export!(MyFoo); use foo::{MixedStruct, NestedStruct, Pair, Triple}; -use miden::{felt, Felt, Word}; +use miden::{Felt, Word, felt}; struct MyFoo; diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs index 2435958aa..b5a07e001 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -18,6 +19,13 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +// Required for no-std crates +#[cfg(not(test))] +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + use bindings::exports::miden::cross_ctx_account::*; miden::generate!(); diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs index 1a4f32632..7f3eed4d8 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -18,6 +19,13 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +// Required for no-std crates +#[cfg(not(test))] +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + miden::generate!(); bindings::export!(MyNote); diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs index 747827328..3439fc992 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -18,6 +19,13 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +// Required for no-std crates +#[cfg(not(test))] +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + miden::generate!(); bindings::export!(MyNote); diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs index cc3d536b6..0c5339152 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs @@ -1,5 +1,6 @@ // 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: @@ -18,6 +19,13 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } +// Required for no-std crates +#[cfg(not(test))] +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + use miden::*; miden::generate!(); diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index 7f1866495..6f534115c 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -4,19 +4,18 @@ use std::{ process::{Command, Stdio}, }; -use anyhow::{bail, Context, Result}; -use cargo_metadata::{camino, Artifact, Message, Metadata, MetadataCommand, Package}; +use anyhow::{Context, Result, bail}; +use cargo_metadata::{Artifact, Message, Metadata, MetadataCommand, Package, camino}; use clap::Args; use midenc_compile::Compiler; use midenc_session::TargetEnv; use path_absolutize::Absolutize; use crate::{ - compile_masm, + BuildOutput, CommandOutput, OutputType, compile_masm, config::CargoPackageSpec, dependencies::process_miden_dependencies, target::{self, install_wasm32_target}, - BuildOutput, CommandOutput, OutputType, }; /// Command-line arguments accepted by `cargo miden build`. @@ -78,29 +77,22 @@ impl BuildCommand { // Remove the source file paths in the data segment for panics // https://doc.rust-lang.org/beta/unstable-book/compiler-flags/location-detail.html extra_rust_flags.push_str(" -Zlocation-detail=none"); - let maybe_old_rustflags = match std::env::var("RUSTFLAGS") { - Ok(current) if !current.is_empty() => { - std::env::set_var("RUSTFLAGS", format!("{current} {extra_rust_flags}")); - Some(current) - } - _ => { - std::env::set_var("RUSTFLAGS", extra_rust_flags); - None - } - }; + // Build with panic=immediate-abort + extra_rust_flags.push_str(" -Zunstable-options"); + extra_rust_flags.push_str(" -Cpanic=immediate-abort"); + if let Ok(inherited) = std::env::var("RUSTFLAGS") + && !inherited.is_empty() + { + extra_rust_flags.push(' '); + extra_rust_flags.push_str(&inherited); + } let wasi = match target_env { TargetEnv::Rollup { .. } => "wasip2", _ => "wasip1", }; - let wasm_outputs = run_cargo(wasi, &spawn_args)?; - - if let Some(old_rustflags) = maybe_old_rustflags { - std::env::set_var("RUSTFLAGS", old_rustflags); - } else { - std::env::remove_var("RUSTFLAGS"); - } + let wasm_outputs = run_cargo(wasi, &spawn_args, [("RUSTFLAGS", extra_rust_flags)])?; assert_eq!(wasm_outputs.len(), 1, "expected only one Wasm artifact"); let wasm_output = wasm_outputs.first().expect("expected at least one Wasm artifact"); @@ -196,14 +188,9 @@ fn build_cargo_args(cargo_opts: &CargoOptions) -> Vec { // Add build-std flags required for Miden compilation args.extend( - [ - "-Z", - "build-std=std,core,alloc,panic_abort", - "-Z", - "unstable-options -Cpanic=immediate-abort", - ] - .into_iter() - .map(|s| s.to_string()), + ["-Z", "build-std=core,alloc,proc_macro,panic_abort", "-Z", "build-std-features="] + .into_iter() + .map(|s| s.to_string()), ); // Configure profile settings @@ -274,13 +261,17 @@ fn merge_midenc_flags(mut base: Vec, compiler: &Compiler) -> Vec base } -fn run_cargo(wasi: &str, spawn_args: &[String]) -> Result> { +fn run_cargo(wasi: &str, spawn_args: &[String], env: E) -> Result> +where + E: IntoIterator, +{ 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.envs(env); cargo.args(spawn_args); // Handle the target for buildable commands From 1a32fc0c9d6df5ce1a0cc7bbe39d4bddec09957a Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Sun, 14 Dec 2025 13:53:44 -0500 Subject: [PATCH 57/70] fix(cargo-miden): allow local override of project-template templates When an empty template path was given to `cargo miden new`, it would generate using a template from a different repo (project-template) than our other templates (from the rust-templates repo). Local overrides of the template sources would only work for rust-templates, and would cause any use of project-template templates to fail with an error. This fixes up the handling of local template overrides, and allows overriding both rust-templates and project-template template sources. --- tools/cargo-miden/tests/build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/cargo-miden/tests/build.rs b/tools/cargo-miden/tests/build.rs index afe9f172a..35c523c38 100644 --- a/tools/cargo-miden/tests/build.rs +++ b/tools/cargo-miden/tests/build.rs @@ -14,7 +14,13 @@ fn example_project_args(example_name: &str) -> Vec { } fn new_project_args(project_name: &str, template: &str) -> Vec { - let template = if let Ok(templates_path) = std::env::var("TEST_LOCAL_TEMPLATES_PATH") { + let template = if template.is_empty() { + if let Ok(project_template_path) = std::env::var("TEST_LOCAL_PROJECT_TEMPLATE_PATH") { + &format!("--template-path={project_template_path}") + } else { + template + } + } else if let Ok(templates_path) = std::env::var("TEST_LOCAL_TEMPLATES_PATH") { &format!("--template-path={templates_path}/{}", template.strip_prefix("--").unwrap()) } else { template From 3b637d1dcbd62a4c9a0d5f28acf5a2ee61282dc7 Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Sun, 14 Dec 2025 13:53:44 -0500 Subject: [PATCH 58/70] chore: switch to Rust edition 2024 --- Cargo.toml | 2 +- benches/src/lib.rs | 12 ++-- codegen/masm/src/linker.rs | 10 ++- codegen/masm/src/stack.rs | 10 +-- dialects/cf/src/ops.rs | 69 +++++++++---------- dialects/hir/src/ops/cast.rs | 9 ++- docs/external/src/guides/rust_to_wasm.md | 6 +- examples/auth-component-no-auth/Cargo.toml | 2 +- .../rust-toolchain.toml | 2 +- .../auth-component-rpo-falcon512/Cargo.toml | 2 +- examples/basic-wallet-tx-script/Cargo.toml | 2 +- examples/basic-wallet/Cargo.toml | 2 +- examples/collatz/Cargo.toml | 4 +- examples/collatz/src/lib.rs | 4 +- examples/counter-contract/Cargo.toml | 2 +- examples/counter-note/Cargo.toml | 2 +- examples/fibonacci/Cargo.toml | 4 +- examples/fibonacci/src/lib.rs | 4 +- examples/is-prime/Cargo.toml | 4 +- examples/is-prime/src/lib.rs | 2 +- examples/p2id-note/Cargo.toml | 2 +- examples/p2ide-note/Cargo.toml | 2 +- examples/storage-example/Cargo.toml | 2 +- frontend/wasm/src/component/translator.rs | 28 ++++---- frontend/wasm/src/module/build_ir.rs | 9 ++- hir-analysis/src/analyses/spills.rs | 38 +++++----- hir-analysis/src/analysis/state/guard.rs | 36 +++++----- hir-analysis/src/analysis/state/raw.rs | 10 +-- hir-analysis/src/solver/allocator.rs | 18 +++-- hir-macros/src/lib.rs | 24 +++---- hir-macros/src/operation.rs | 44 +++++------- hir/src/adt/arena.rs | 20 +++--- hir/src/ir/callable.rs | 16 +++-- hir/src/ir/dominance/nca.rs | 12 ++-- hir/src/ir/entity.rs | 2 +- hir/src/ir/entity/list.rs | 20 +++--- hir/src/ir/immediates.rs | 24 +++---- hir/src/ir/loops.rs | 14 ++-- hir/src/ir/operation.rs | 44 ++++++------ hir/src/ir/operation/name.rs | 7 +- hir/src/ir/region/branch_point.rs | 4 +- hir/src/ir/region/transforms/dce.rs | 17 ++--- .../region/transforms/drop_redundant_args.rs | 16 ++--- hir/src/ir/successor.rs | 4 +- hir/src/ir/symbols.rs | 10 +-- hir/src/ir/symbols/path.rs | 10 +-- hir/src/ir/symbols/table.rs | 10 +-- hir/src/ir/traits/foldable.rs | 2 +- hir/src/ir/traits/info.rs | 4 +- hir/src/pass/manager.rs | 68 +++++++++--------- hir/src/patterns/pattern_set.rs | 2 +- hir/src/patterns/rewriter.rs | 17 ++--- hir/src/program_point.rs | 8 +-- midenc-session/src/inputs.rs | 6 +- midenc-session/src/lib.rs | 19 +++-- midenc-session/src/outputs.rs | 26 +++---- rustfmt.toml | 2 +- sdk/alloc/build.rs | 2 +- sdk/alloc/src/lib.rs | 10 +-- sdk/alloc/stubs/heap_base.rs | 3 +- sdk/base-macros/src/component_macro/mod.rs | 21 +++--- sdk/base-sys/build.rs | 2 +- sdk/base-sys/src/bindings/active_account.rs | 2 +- sdk/base-sys/src/bindings/active_note.rs | 2 +- sdk/base-sys/src/bindings/asset.rs | 2 +- sdk/base-sys/src/bindings/faucet.rs | 2 +- sdk/base-sys/src/bindings/input_note.rs | 2 +- sdk/base-sys/src/bindings/native_account.rs | 2 +- sdk/base-sys/src/bindings/output_note.rs | 2 +- sdk/base-sys/src/bindings/storage.rs | 2 +- sdk/base-sys/src/bindings/tx.rs | 2 +- sdk/base-sys/stubs/active_account.rs | 38 +++++----- sdk/base-sys/stubs/active_note.rs | 16 ++--- sdk/base-sys/stubs/asset.rs | 4 +- sdk/base-sys/stubs/faucet.rs | 28 +++----- sdk/base-sys/stubs/input_note.rs | 21 +++--- sdk/base-sys/stubs/native_account.rs | 14 ++-- sdk/base-sys/stubs/output_note.rs | 17 ++--- sdk/base-sys/stubs/tx.rs | 18 ++--- sdk/stdlib-sys/build.rs | 4 +- sdk/stdlib-sys/src/intrinsics/advice.rs | 6 +- sdk/stdlib-sys/src/intrinsics/crypto.rs | 2 +- sdk/stdlib-sys/src/intrinsics/debug.rs | 2 +- sdk/stdlib-sys/src/intrinsics/felt.rs | 2 +- sdk/stdlib-sys/src/stdlib/collections/smt.rs | 2 +- sdk/stdlib-sys/src/stdlib/crypto/dsa.rs | 2 +- sdk/stdlib-sys/src/stdlib/crypto/hashes.rs | 8 +-- sdk/stdlib-sys/src/stdlib/mem.rs | 2 +- sdk/stdlib-sys/stubs/collections.rs | 8 +-- sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs | 5 +- sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs | 4 +- sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs | 5 +- sdk/stdlib-sys/stubs/crypto/rpo_falcon_dsa.rs | 2 +- sdk/stdlib-sys/stubs/intrinsics/advice.rs | 8 +-- sdk/stdlib-sys/stubs/intrinsics/crypto.rs | 3 +- sdk/stdlib-sys/stubs/intrinsics/debug.rs | 3 +- sdk/stdlib-sys/stubs/intrinsics/felt.rs | 41 ++++++----- sdk/stdlib-sys/stubs/mem.rs | 7 +- .../integration-node/src/local_node/setup.rs | 12 ++-- tests/integration-node/src/local_node/sync.rs | 24 +++---- tests/integration/src/cargo_proj/mod.rs | 8 +-- tests/integration/src/compiler_test.rs | 24 +++---- tests/integration/src/rust_masm_tests/apps.rs | 12 ++-- tests/integration/src/rust_masm_tests/misc.rs | 6 +- .../rust_masm_tests/rust_sdk/base/account.rs | 2 +- .../rust_masm_tests/rust_sdk/base/asset.rs | 2 +- .../rust_masm_tests/rust_sdk/base/faucet.rs | 2 +- .../rust_sdk/base/input_note.rs | 2 +- .../src/rust_masm_tests/rust_sdk/base/note.rs | 2 +- .../rust_sdk/base/output_note.rs | 2 +- .../src/rust_masm_tests/rust_sdk/base/tx.rs | 2 +- .../src/rust_masm_tests/rust_sdk/mod.rs | 8 +-- .../src/rust_masm_tests/types_src/array.rs | 4 +- .../src/rust_masm_tests/types_src/enum.rs | 4 +- .../rust_masm_tests/types_src/static_mut.rs | 4 +- .../source-location/test-project/Cargo.toml | 2 +- .../source-location/test-project/src/lib.rs | 4 +- .../rust-sdk/account-test/Cargo.toml | 2 +- .../rust-sdk/account-test/src/lib.rs | 22 +++--- tests/rust-apps-wasm/rust-sdk/add/Cargo.toml | 2 +- tests/rust-apps-wasm/rust-sdk/add/src/lib.rs | 2 +- .../component-macros-account/Cargo.toml | 2 +- .../rust-sdk/component-macros-note/Cargo.toml | 2 +- .../cross-ctx-account-word-arg/Cargo.toml | 2 +- .../cross-ctx-account-word/Cargo.toml | 2 +- .../rust-sdk/cross-ctx-account/Cargo.toml | 2 +- .../cross-ctx-note-word-arg/Cargo.toml | 2 +- .../rust-sdk/cross-ctx-note-word/Cargo.toml | 2 +- .../rust-sdk/cross-ctx-note/Cargo.toml | 2 +- .../src/commands/example_project.rs | 62 ++++++++--------- tools/cargo-miden/src/commands/new_project.rs | 10 +-- tools/cargo-miden/tests/build.rs | 6 +- tools/cargo-miden/tests/workspace.rs | 28 +++++--- tools/expect-test/src/lib.rs | 17 +++-- 134 files changed, 665 insertions(+), 707 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 45e094c1b..c275d5212 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ categories = ["compilers"] keywords = ["compiler", "miden"] license = "MIT" readme = "README.md" -edition = "2021" +edition = "2024" publish = false [workspace.dependencies] diff --git a/benches/src/lib.rs b/benches/src/lib.rs index c7b70bb2d..c9c719661 100644 --- a/benches/src/lib.rs +++ b/benches/src/lib.rs @@ -43,12 +43,12 @@ impl ExecutionStats { for line in output.lines() { if line.contains("VM cycles:") { // Look for pattern like "VM cycles: 805 extended to 1024 steps" - if let Some(cycles_part) = line.split("VM cycles:").nth(1) { - if let Some(cycles_str) = cycles_part.split_whitespace().next() { - return cycles_str.parse().with_context(|| { - format!("Failed to parse VM cycles from: {cycles_str}") - }); - } + if let Some(cycles_part) = line.split("VM cycles:").nth(1) + && let Some(cycles_str) = cycles_part.split_whitespace().next() + { + return cycles_str + .parse() + .with_context(|| format!("Failed to parse VM cycles from: {cycles_str}")); } } } diff --git a/codegen/masm/src/linker.rs b/codegen/masm/src/linker.rs index 8633e8a34..b29bd6145 100644 --- a/codegen/masm/src/linker.rs +++ b/codegen/masm/src/linker.rs @@ -1,6 +1,6 @@ use midenc_hir::{ - dialects::builtin::{self, DataSegmentError, SegmentRef}, Alignable, FxHashMap, Symbol, + dialects::builtin::{self, DataSegmentError, SegmentRef}, }; const DEFAULT_PAGE_SIZE: u32 = 2u32.pow(16); @@ -277,11 +277,9 @@ impl GlobalVariableLayout { // Ensure the stack pointer is tracked and uses the same offset globally let is_stack_pointer = gv.name() == "__stack_pointer"; - if is_stack_pointer { - if let Some(offset) = self.stack_pointer { - let _ = self.offsets.try_insert(key, offset); - return; - } + if is_stack_pointer && let Some(offset) = self.stack_pointer { + let _ = self.offsets.try_insert(key, offset); + return; } let ty = gv.ty(); diff --git a/codegen/masm/src/stack.rs b/codegen/masm/src/stack.rs index 0ca962f0b..2e974c1f3 100644 --- a/codegen/masm/src/stack.rs +++ b/codegen/masm/src/stack.rs @@ -5,7 +5,7 @@ use core::{ use miden_core::{Felt, FieldElement}; use midenc_hir::{AttributeValue, Immediate, Type, ValueRef}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; /// This represents a constraint an operand's usage at /// a given program point, namely when used as an instruction @@ -48,7 +48,7 @@ impl OperandType { imm.downcast_ref::().expect("unexpected constant value type").ty() } Self::Value(value) => value.borrow().ty().clone(), - Self::Type(ref ty) => ty.clone(), + Self::Type(ty) => ty.clone(), } } } @@ -67,9 +67,9 @@ impl PartialEq for OperandType { match (self, other) { (Self::Value(a), Self::Value(b)) => a == b, (Self::Value(_), _) | (_, Self::Value(_)) => false, - (Self::Const(ref a), Self::Const(ref b)) => a == b, + (Self::Const(a), Self::Const(b)) => a == b, (Self::Const(_), _) | (_, Self::Const(_)) => false, - (Self::Type(ref a), Self::Type(ref b)) => a == b, + (Self::Type(a), Self::Type(b)) => a == b, } } } @@ -329,7 +329,7 @@ impl OperandStack { /// The type is assumed to remain unchanged pub fn rename(&mut self, n: usize, value: ValueRef) { match &mut self[n].operand { - OperandType::Value(ref mut prev_value) => { + OperandType::Value(prev_value) => { *prev_value = value; } prev => { diff --git a/dialects/cf/src/ops.rs b/dialects/cf/src/ops.rs index c887837fa..85b5ca3fc 100644 --- a/dialects/cf/src/ops.rs +++ b/dialects/cf/src/ops.rs @@ -327,24 +327,23 @@ impl Foldable for Select { fn fold(&self, results: &mut SmallVec<[OpFoldResult; 1]>) -> FoldResult { if let Some(value) = matchers::foldable_operand_of::().matches(&self.cond().as_operand_ref()) + && let Some(cond) = value.as_bool() { - if let Some(cond) = value.as_bool() { - let maybe_folded = if cond { - matchers::foldable_operand() - .matches(&self.first().as_operand_ref()) - .map(OpFoldResult::Attribute) - .or_else(|| Some(OpFoldResult::Value(self.first().as_value_ref()))) - } else { - matchers::foldable_operand() - .matches(&self.second().as_operand_ref()) - .map(OpFoldResult::Attribute) - .or_else(|| Some(OpFoldResult::Value(self.second().as_value_ref()))) - }; - - if let Some(folded) = maybe_folded { - results.push(folded); - return FoldResult::Ok(()); - } + let maybe_folded = if cond { + matchers::foldable_operand() + .matches(&self.first().as_operand_ref()) + .map(OpFoldResult::Attribute) + .or_else(|| Some(OpFoldResult::Value(self.first().as_value_ref()))) + } else { + matchers::foldable_operand() + .matches(&self.second().as_operand_ref()) + .map(OpFoldResult::Attribute) + .or_else(|| Some(OpFoldResult::Value(self.second().as_value_ref()))) + }; + + if let Some(folded) = maybe_folded { + results.push(folded); + return FoldResult::Ok(()); } } @@ -357,24 +356,24 @@ impl Foldable for Select { operands: &[Option>], results: &mut SmallVec<[OpFoldResult; 1]>, ) -> FoldResult { - if let Some(value) = operands[0].as_deref().and_then(|o| o.downcast_ref::()) { - if let Some(cond) = value.as_bool() { - let maybe_folded = if cond { - operands[1] - .as_deref() - .map(|o| OpFoldResult::Attribute(o.clone_value())) - .or_else(|| Some(OpFoldResult::Value(self.first().as_value_ref()))) - } else { - operands[2] - .as_deref() - .map(|o| OpFoldResult::Attribute(o.clone_value())) - .or_else(|| Some(OpFoldResult::Value(self.second().as_value_ref()))) - }; - - if let Some(folded) = maybe_folded { - results.push(folded); - return FoldResult::Ok(()); - } + if let Some(value) = operands[0].as_deref().and_then(|o| o.downcast_ref::()) + && let Some(cond) = value.as_bool() + { + let maybe_folded = if cond { + operands[1] + .as_deref() + .map(|o| OpFoldResult::Attribute(o.clone_value())) + .or_else(|| Some(OpFoldResult::Value(self.first().as_value_ref()))) + } else { + operands[2] + .as_deref() + .map(|o| OpFoldResult::Attribute(o.clone_value())) + .or_else(|| Some(OpFoldResult::Value(self.second().as_value_ref()))) + }; + + if let Some(folded) = maybe_folded { + results.push(folded); + return FoldResult::Ok(()); } } FoldResult::Failed diff --git a/dialects/hir/src/ops/cast.rs b/dialects/hir/src/ops/cast.rs index 373d49424..a0ff938fb 100644 --- a/dialects/hir/src/ops/cast.rs +++ b/dialects/hir/src/ops/cast.rs @@ -207,12 +207,11 @@ impl Foldable for Bitcast { #[inline] fn fold(&self, results: &mut SmallVec<[OpFoldResult; 1]>) -> FoldResult { if let Some(value) = matchers::foldable_operand().matches(&self.operand().as_operand_ref()) + && (value.is::() || value.is::()) { - if value.is::() || value.is::() { - // Lean on materialize_constant to handle the conversion details - results.push(OpFoldResult::Attribute(value)); - return FoldResult::Ok(()); - } + // Lean on materialize_constant to handle the conversion details + results.push(OpFoldResult::Attribute(value)); + return FoldResult::Ok(()); } FoldResult::Failed diff --git a/docs/external/src/guides/rust_to_wasm.md b/docs/external/src/guides/rust_to_wasm.md index bdc41e593..dd9ba466b 100644 --- a/docs/external/src/guides/rust_to_wasm.md +++ b/docs/external/src/guides/rust_to_wasm.md @@ -35,7 +35,7 @@ Next, edit the `Cargo.toml` file as follows: [package] name = "wasm-fib" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library @@ -108,10 +108,10 @@ fn panic(_info: &core::panic::PanicInfo) -> ! { // a mangled name that has no stable form. // // You can specify a different name from the library than the -// name in the source code using the `#[export_name = "foo"]` +// name in the source code using the `#[unsafe(export_name = "foo")]` // attribute, which will make the function callable as `foo` // externally (in this example) -#[no_mangle] +#[unsafe(no_mangle)] pub fn fib(n: u32) -> u32 { let mut a = 0; let mut b = 1; diff --git a/examples/auth-component-no-auth/Cargo.toml b/examples/auth-component-no-auth/Cargo.toml index 574279dfa..e55547311 100644 --- a/examples/auth-component-no-auth/Cargo.toml +++ b/examples/auth-component-no-auth/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "auth-component-no-auth" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/auth-component-no-auth/rust-toolchain.toml b/examples/auth-component-no-auth/rust-toolchain.toml index dd49b3008..d9d7c02f0 100644 --- a/examples/auth-component-no-auth/rust-toolchain.toml +++ b/examples/auth-component-no-auth/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "clippy"] targets = ["wasm32-wasip2"] profile = "minimal" diff --git a/examples/auth-component-rpo-falcon512/Cargo.toml b/examples/auth-component-rpo-falcon512/Cargo.toml index 02098c8af..c5b88f9eb 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.toml +++ b/examples/auth-component-rpo-falcon512/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "auth-component-rpo-falcon512" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/basic-wallet-tx-script/Cargo.toml b/examples/basic-wallet-tx-script/Cargo.toml index 2dbe90edf..94957b624 100644 --- a/examples/basic-wallet-tx-script/Cargo.toml +++ b/examples/basic-wallet-tx-script/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "basic-wallet-tx-script" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/basic-wallet/Cargo.toml b/examples/basic-wallet/Cargo.toml index ad6ca95be..7f1f7add8 100644 --- a/examples/basic-wallet/Cargo.toml +++ b/examples/basic-wallet/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "basic_wallet" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/collatz/Cargo.toml b/examples/collatz/Cargo.toml index 23d5f3730..545b86471 100644 --- a/examples/collatz/Cargo.toml +++ b/examples/collatz/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "collatz" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library @@ -12,5 +12,3 @@ crate-type = ["cdylib"] # Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) # and transaction kernel API for the Miden rollup #miden = { git = "https://github.com/0xMiden/compiler" } - - diff --git a/examples/collatz/src/lib.rs b/examples/collatz/src/lib.rs index af26ce898..b65f156dc 100644 --- a/examples/collatz/src/lib.rs +++ b/examples/collatz/src/lib.rs @@ -30,9 +30,9 @@ fn alloc_failed(_layout: core::alloc::Layout) -> ! { // // NOTE: // The name of the entrypoint function is expected to be `entrypoint`. Do not remove the -// `#[no_mangle]` attribute, otherwise, the rustc will mangle the name and it'll not be recognized +// `#[unsafe(no_mangle)]` attribute, otherwise, the rustc will mangle the name and it'll not be recognized // by the Miden compiler. -#[no_mangle] +#[unsafe(no_mangle)] fn entrypoint(mut n: u32) -> u32 { let mut steps = 0; while n != 1 { diff --git a/examples/counter-contract/Cargo.toml b/examples/counter-contract/Cargo.toml index b0fab6cd0..9e0b92f55 100644 --- a/examples/counter-contract/Cargo.toml +++ b/examples/counter-contract/Cargo.toml @@ -2,7 +2,7 @@ name = "counter-contract" description = "A simple example of a Miden counter contract using the Account Storage API" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/counter-note/Cargo.toml b/examples/counter-note/Cargo.toml index d4fe17164..176e1ab11 100644 --- a/examples/counter-note/Cargo.toml +++ b/examples/counter-note/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "counter-note" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/fibonacci/Cargo.toml b/examples/fibonacci/Cargo.toml index 21fb11c85..a47048645 100644 --- a/examples/fibonacci/Cargo.toml +++ b/examples/fibonacci/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "fibonacci" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library @@ -12,5 +12,3 @@ crate-type = ["cdylib"] # Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) # and transaction kernel API for the Miden rollup #miden = { git = "https://github.com/0xMiden/compiler" } - - diff --git a/examples/fibonacci/src/lib.rs b/examples/fibonacci/src/lib.rs index df0fea6bf..f6228c3ff 100644 --- a/examples/fibonacci/src/lib.rs +++ b/examples/fibonacci/src/lib.rs @@ -30,9 +30,9 @@ fn alloc_failed(_layout: core::alloc::Layout) -> ! { // // NOTE: // The name of the entrypoint function is expected to be `entrypoint`. Do not remove the -// `#[no_mangle]` attribute, otherwise, the rustc will mangle the name and it'll not be recognized +// `#[unsafe(no_mangle)]` attribute, otherwise, the rustc will mangle the name and it'll not be recognized // by the Miden compiler. -#[no_mangle] +#[unsafe(no_mangle)] pub fn entrypoint(n: u32) -> u32 { let mut a = 0; let mut b = 1; diff --git a/examples/is-prime/Cargo.toml b/examples/is-prime/Cargo.toml index 6783d56d4..49e603c97 100644 --- a/examples/is-prime/Cargo.toml +++ b/examples/is-prime/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "is_prime" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library @@ -12,5 +12,3 @@ crate-type = ["cdylib"] # Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) # and transaction kernel API for the Miden rollup #miden = { git = "https://github.com/0xMiden/compiler" } - - diff --git a/examples/is-prime/src/lib.rs b/examples/is-prime/src/lib.rs index 9073b5214..4cb8cdfac 100644 --- a/examples/is-prime/src/lib.rs +++ b/examples/is-prime/src/lib.rs @@ -35,7 +35,7 @@ fn is_prime(n: u32) -> bool { } /// https://www.math.utah.edu/~pa/MDS/primes.html -#[no_mangle] +#[unsafe(no_mangle)] fn entrypoint(n: u32) -> bool { return is_prime(n); } diff --git a/examples/p2id-note/Cargo.toml b/examples/p2id-note/Cargo.toml index c1e47a173..a3c70a012 100644 --- a/examples/p2id-note/Cargo.toml +++ b/examples/p2id-note/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "p2id" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/p2ide-note/Cargo.toml b/examples/p2ide-note/Cargo.toml index a0e93ec29..207efafa8 100644 --- a/examples/p2ide-note/Cargo.toml +++ b/examples/p2ide-note/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "p2ide" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/examples/storage-example/Cargo.toml b/examples/storage-example/Cargo.toml index 745ffd63b..f2176b340 100644 --- a/examples/storage-example/Cargo.toml +++ b/examples/storage-example/Cargo.toml @@ -2,7 +2,7 @@ name = "storage-example" description = "A simple example of a Miden account storage API" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/frontend/wasm/src/component/translator.rs b/frontend/wasm/src/component/translator.rs index 140e05d85..fa2accc31 100644 --- a/frontend/wasm/src/component/translator.rs +++ b/frontend/wasm/src/component/translator.rs @@ -2,28 +2,29 @@ use std::rc::Rc; use cranelift_entity::PrimaryMap; use midenc_hir::{ - self as hir2, + self as hir2, BuilderExt, CallConv, Context, FunctionType, FxHashMap, Ident, + SymbolNameComponent, SymbolPath, diagnostics::Report, dialects::builtin::{self, ComponentBuilder, ModuleBuilder, World, WorldBuilder}, formatter::DisplayValues, interner::Symbol, - smallvec, BuilderExt, CallConv, Context, FunctionType, FxHashMap, Ident, SymbolNameComponent, - SymbolPath, + smallvec, }; use wasmparser::{component_types::ComponentEntityType, types::TypesRef}; use super::{ - interface_type_to_ir, - shim_bypass::{self, ShimBypassInfo}, CanonLift, CanonLower, ClosedOverComponent, ClosedOverModule, ComponentFuncIndex, ComponentIndex, ComponentInstanceIndex, ComponentInstantiation, ComponentTypesBuilder, ComponentUpvarIndex, ModuleIndex, ModuleInstanceIndex, ModuleUpvarIndex, ParsedComponent, StaticModuleIndex, TypeComponentInstanceIndex, TypeDef, TypeFuncIndex, TypeModuleIndex, + interface_type_to_ir, + shim_bypass::{self, ShimBypassInfo}, }; use crate::{ + FrontendOutput, WasmTranslationConfig, component::{ - lift_exports::generate_export_lifting_function, ComponentItem, LocalInitializer, - StaticComponentIndex, + ComponentItem, LocalInitializer, StaticComponentIndex, + lift_exports::generate_export_lifting_function, }, error::WasmResult, module::{ @@ -33,7 +34,7 @@ use crate::{ module_translation_state::ModuleTranslationState, types::{EntityIndex, FuncIndex}, }, - unsupported_diag, FrontendOutput, WasmTranslationConfig, + unsupported_diag, }; /// A translator from the linearized Wasm component model to the Miden IR component @@ -252,7 +253,7 @@ impl<'a> ComponentTranslator<'a> { self.shim_bypass_info.fixup_module_indices.push(module_idx); } } - LocalInitializer::ModuleInstantiate(module_idx, ref args) => { + LocalInitializer::ModuleInstantiate(module_idx, args) => { self.module_instantiation(frame, types, module_idx, args)?; } LocalInitializer::ModuleSynthetic(entities) => { @@ -285,7 +286,7 @@ impl<'a> ComponentTranslator<'a> { self.shim_bypass_info.shim_instance_indices.push(instance_idx); } } - LocalInitializer::ComponentStatic(idx, ref vars) => { + LocalInitializer::ComponentStatic(idx, vars) => { frame.components.push(ComponentDef { index: *idx, closure: ComponentClosure { @@ -305,7 +306,7 @@ impl<'a> ComponentTranslator<'a> { LocalInitializer::ComponentInstantiate( instance @ ComponentInstantiation { component, - ref args, + args, ty: _, }, ) => { @@ -943,7 +944,7 @@ impl<'a> ComponentItemDef<'a> { ty: TypeDef, component_instance_idx: ComponentInstanceIndex, ) -> ComponentItemDef<'a> { - let item = match ty { + match ty { TypeDef::Module(ty) => ComponentItemDef::Module(ModuleDef::Import(ty)), TypeDef::ComponentInstance(ty) => { ComponentItemDef::Instance(ComponentInstanceDef::Import(ComponentInstanceImport { @@ -958,8 +959,7 @@ impl<'a> ComponentItemDef<'a> { )), TypeDef::Component(_ty) => panic!("root-level component imports are not supported"), TypeDef::Interface(_) | TypeDef::Resource(_) => ComponentItemDef::Type(ty), - }; - item + } } } diff --git a/frontend/wasm/src/module/build_ir.rs b/frontend/wasm/src/module/build_ir.rs index eb726ec68..eb67234bb 100644 --- a/frontend/wasm/src/module/build_ir.rs +++ b/frontend/wasm/src/module/build_ir.rs @@ -2,21 +2,22 @@ use core::mem; use std::rc::Rc; use midenc_hir::{ + Builder, BuilderExt, Context, FxHashMap, Ident, Op, OpBuilder, Visibility, constants::ConstantData, dialects::builtin::{ self, BuiltinOpBuilder, ComponentBuilder, ModuleBuilder, World, WorldBuilder, }, interner::Symbol, version::Version, - Builder, BuilderExt, Context, FxHashMap, Ident, Op, OpBuilder, Visibility, }; use midenc_session::diagnostics::{DiagnosticsHandler, IntoDiagnostic, Severity, SourceSpan}; use wasmparser::Validator; use super::{ - module_translation_state::ModuleTranslationState, types::ModuleTypesBuilder, MemoryIndex, + MemoryIndex, module_translation_state::ModuleTranslationState, types::ModuleTypesBuilder, }; use crate::{ + WasmTranslationConfig, error::WasmResult, module::{ func_translator::FuncTranslator, @@ -24,7 +25,6 @@ use crate::{ module_env::{FunctionBodyData, ModuleEnvironment, ParsedModule}, types::ir_type, }, - WasmTranslationConfig, }; /// Translate a valid Wasm core module binary into Miden IR component building @@ -190,8 +190,7 @@ fn build_globals( let context = global_var_ref.borrow().as_operation().context_rc().clone(); let init_region_ref = { let mut global_var = global_var_ref.borrow_mut(); - let region_ref = global_var.initializer_mut().as_region_ref(); - region_ref + global_var.initializer_mut().as_region_ref() }; let mut op_builder = OpBuilder::new(context); op_builder.create_block(init_region_ref, None, &[]); diff --git a/hir-analysis/src/analyses/spills.rs b/hir-analysis/src/analyses/spills.rs index aa9385ba9..5533d5564 100644 --- a/hir-analysis/src/analyses/spills.rs +++ b/hir-analysis/src/analyses/spills.rs @@ -1,6 +1,10 @@ use alloc::{boxed::Box, collections::VecDeque, vec::Vec}; 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, adt::{SmallOrdMap, SmallSet}, cfg::Graph, dialects::builtin::Function, @@ -9,19 +13,15 @@ use midenc_hir::{ loops::{Loop, LoopForest, LoopInfo}, pass::{Analysis, AnalysisManager, PreservedAnalyses}, traits::{BranchOpInterface, IsolatedFromAbove, Terminator}, - AttributeValue, Block, BlockRef, FxHashMap, FxHashSet, LoopLikeOpInterface, Op, Operation, - OperationRef, ProgramPoint, Region, RegionBranchOpInterface, RegionBranchPoint, - RegionBranchTerminatorOpInterface, Report, SmallVec, SourceSpan, Spanned, SuccessorOperands, - Value, ValueOrAlias, ValueRange, ValueRef, }; use super::dce::{CfgEdge, Executable}; use crate::{ + Lattice, analyses::{ - constant_propagation::ConstantValue, dce::PredecessorState, liveness::LOOP_EXIT_DISTANCE, - LivenessAnalysis, + LivenessAnalysis, constant_propagation::ConstantValue, dce::PredecessorState, + liveness::LOOP_EXIT_DISTANCE, }, - Lattice, }; #[cfg(test)] @@ -1540,13 +1540,13 @@ impl SpillAnalysis { let mut live_through = live_through.into_iter(); while free_in_loop > 0 { - if let Some(operand) = live_through.next() { - if let Some(new_free) = free_in_loop.checked_sub(operand.stack_size()) { - if cand.insert(operand) { - free_in_loop = new_free; - } - continue; + if let Some(operand) = live_through.next() + && let Some(new_free) = free_in_loop.checked_sub(operand.stack_size()) + { + if cand.insert(operand) { + free_in_loop = new_free; } + continue; } break; } @@ -1631,13 +1631,13 @@ impl SpillAnalysis { let mut live_through = live_through.into_iter(); while free_in_loop > 0 { - if let Some(operand) = live_through.next() { - if let Some(new_free) = free_in_loop.checked_sub(operand.stack_size()) { - if cand.insert(operand) { - free_in_loop = new_free; - } - continue; + if let Some(operand) = live_through.next() + && let Some(new_free) = free_in_loop.checked_sub(operand.stack_size()) + { + if cand.insert(operand) { + free_in_loop = new_free; } + continue; } break; } diff --git a/hir-analysis/src/analysis/state/guard.rs b/hir-analysis/src/analysis/state/guard.rs index 0df4d6c4f..ac46997d7 100644 --- a/hir-analysis/src/analysis/state/guard.rs +++ b/hir-analysis/src/analysis/state/guard.rs @@ -2,12 +2,12 @@ use alloc::rc::Rc; use core::{cell::RefCell, ptr::NonNull}; use midenc_hir::{ - entity::{BorrowRef, BorrowRefMut}, EntityRef, + entity::{BorrowRef, BorrowRefMut}, }; use super::*; -use crate::{solver::AnalysisQueue, ChangeResult, DenseLattice, SparseLattice}; +use crate::{ChangeResult, DenseLattice, SparseLattice, solver::AnalysisQueue}; /// An immmutable handle/guard for some analysis state T pub struct AnalysisStateGuard<'a, T: AnalysisState + 'static> { @@ -18,12 +18,14 @@ pub struct AnalysisStateGuard<'a, T: AnalysisState + 'static> { } impl<'a, T: AnalysisState + 'static> AnalysisStateGuard<'a, T> { pub(crate) unsafe fn new(info: NonNull) -> Self { - let handle = RawAnalysisStateInfoHandle::new(info); - let (state, _borrow) = handle.state_ref(); - Self { - info, - state, - _borrow, + unsafe { + let handle = RawAnalysisStateInfoHandle::new(info); + let (state, _borrow) = handle.state_ref(); + Self { + info, + state, + _borrow, + } } } @@ -116,14 +118,16 @@ impl<'a, T: AnalysisState + 'static> AnalysisStateGuardMut<'a, T> { info: NonNull, worklist: Rc>, ) -> Self { - let handle = RawAnalysisStateInfoHandle::new(info); - let (state, _borrow) = handle.state_mut(); - Self { - worklist, - info, - state, - _borrow, - changed: ChangeResult::Unchanged, + unsafe { + let handle = RawAnalysisStateInfoHandle::new(info); + let (state, _borrow) = handle.state_mut(); + Self { + worklist, + info, + state, + _borrow, + changed: ChangeResult::Unchanged, + } } } diff --git a/hir-analysis/src/analysis/state/raw.rs b/hir-analysis/src/analysis/state/raw.rs index 605dcc7b2..fa826330f 100644 --- a/hir-analysis/src/analysis/state/raw.rs +++ b/hir-analysis/src/analysis/state/raw.rs @@ -1,8 +1,8 @@ use core::{any::TypeId, ptr::NonNull}; use midenc_hir::{ - entity::{BorrowRef, BorrowRefMut, EntityRef, RawEntity}, FxHashMap, + entity::{BorrowRef, BorrowRefMut, EntityRef, RawEntity}, }; use super::*; @@ -98,9 +98,11 @@ pub struct RawAnalysisStateInfoHandle { } impl RawAnalysisStateInfoHandle { pub unsafe fn new(info: NonNull) -> Self { - let offset = info.as_ref().descriptor().offset; - let state = info.byte_add(offset as usize).cast::>(); - Self { state, offset } + unsafe { + let offset = info.as_ref().descriptor().offset; + let state = info.byte_add(offset as usize).cast::>(); + Self { state, offset } + } } #[track_caller] diff --git a/hir-analysis/src/solver/allocator.rs b/hir-analysis/src/solver/allocator.rs index d9ccc56d8..8eededdaa 100644 --- a/hir-analysis/src/solver/allocator.rs +++ b/hir-analysis/src/solver/allocator.rs @@ -27,7 +27,9 @@ unsafe impl Allocator for DataFlowSolverAlloc { #[inline] unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { - self.0.allocator().deallocate(ptr, layout.size()); + unsafe { + self.0.allocator().deallocate(ptr, layout.size()); + } } #[inline] @@ -42,7 +44,7 @@ unsafe impl Allocator for DataFlowSolverAlloc { old_layout: Layout, new_layout: Layout, ) -> Result, alloc::alloc::AllocError> { - self.0.allocator().grow(ptr, old_layout, new_layout).map_err(|_| AllocError) + unsafe { self.0.allocator().grow(ptr, old_layout, new_layout).map_err(|_| AllocError) } } #[inline] @@ -52,7 +54,7 @@ unsafe impl Allocator for DataFlowSolverAlloc { old_layout: Layout, new_layout: Layout, ) -> Result, alloc::alloc::AllocError> { - self.0.allocator().shrink(ptr, old_layout, new_layout).map_err(|_| AllocError) + unsafe { self.0.allocator().shrink(ptr, old_layout, new_layout).map_err(|_| AllocError) } } #[inline] @@ -62,9 +64,11 @@ unsafe impl Allocator for DataFlowSolverAlloc { old_layout: Layout, new_layout: Layout, ) -> Result, alloc::alloc::AllocError> { - self.0 - .allocator() - .grow_zeroed(ptr, old_layout, new_layout) - .map_err(|_| AllocError) + unsafe { + self.0 + .allocator() + .grow_zeroed(ptr, old_layout, new_layout) + .map_err(|_| AllocError) + } } } diff --git a/hir-macros/src/lib.rs b/hir-macros/src/lib.rs index d41541360..f6a3ca0c5 100644 --- a/hir-macros/src/lib.rs +++ b/hir-macros/src/lib.rs @@ -7,7 +7,7 @@ mod spanned; use inflector::cases::kebabcase::to_kebab_case; use quote::{format_ident, quote}; -use syn::{parse_macro_input, spanned::Spanned, Data, DeriveInput, Error, Ident, Token}; +use syn::{Data, DeriveInput, Error, Ident, Token, parse_macro_input, spanned::Spanned}; #[proc_macro_derive(Spanned, attributes(span))] pub fn derive_spanned(input: proc_macro::TokenStream) -> proc_macro::TokenStream { @@ -152,8 +152,8 @@ pub fn derive_analysis_key(item: proc_macro::TokenStream) -> proc_macro::TokenSt let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); let found = match &derive_input.data { - syn::Data::Struct(ref data) => match &data.fields { - syn::Fields::Named(ref fields) => { + syn::Data::Struct(data) => match &data.fields { + syn::Fields::Named(fields) => { let mut found = None; for field in fields.named.iter() { if field.attrs.iter().any(is_analysis_key_attr) { @@ -170,7 +170,7 @@ pub fn derive_analysis_key(item: proc_macro::TokenStream) -> proc_macro::TokenSt } found } - syn::Fields::Unnamed(ref fields) => { + syn::Fields::Unnamed(fields) => { let mut found = None; for (i, field) in fields.unnamed.iter().enumerate() { if field.attrs.iter().any(is_analysis_key_attr) { @@ -193,18 +193,18 @@ pub fn derive_analysis_key(item: proc_macro::TokenStream) -> proc_macro::TokenSt "structs with unit fields cannot derive AnalysisKey", ) .into_compile_error() - .into() + .into(); } }, syn::Data::Enum(_) => { return syn::Error::new(derive_span, "enums cannot derive AnalysisKey") .into_compile_error() - .into() + .into(); } syn::Data::Union(_) => { return syn::Error::new(derive_span, "unions cannot derive AnalysisKey") .into_compile_error() - .into() + .into(); } }; @@ -213,7 +213,7 @@ pub fn derive_analysis_key(item: proc_macro::TokenStream) -> proc_macro::TokenSt None => { return syn::Error::new(derive_span, "missing #[analysis_key] attribute") .into_compile_error() - .into() + .into(); } }; @@ -236,7 +236,7 @@ pub fn derive_rewrite_pass_registration(item: proc_macro::TokenStream) -> proc_m let mut params = syn::punctuated::Punctuated::<_, Token![,]>::new(); for gp in generics.params.iter() { match gp { - syn::GenericParam::Lifetime(ref lt) => { + syn::GenericParam::Lifetime(lt) => { if !lt.bounds.empty_or_trailing() { return syn::Error::new( gp.span(), @@ -250,7 +250,7 @@ pub fn derive_rewrite_pass_registration(item: proc_macro::TokenStream) -> proc_m ident: Ident::new("_", lt.span()), })); } - syn::GenericParam::Type(ref ty) => { + syn::GenericParam::Type(ty) => { if !ty.bounds.empty_or_trailing() { return syn::Error::new( gp.span(), @@ -326,7 +326,7 @@ pub fn derive_conversion_pass_registration( let mut params = syn::punctuated::Punctuated::<_, Token![,]>::new(); for gp in generics.params.iter() { match gp { - syn::GenericParam::Lifetime(ref lt) => { + syn::GenericParam::Lifetime(lt) => { if !lt.bounds.empty_or_trailing() { return syn::Error::new( gp.span(), @@ -340,7 +340,7 @@ pub fn derive_conversion_pass_registration( ident: Ident::new("_", lt.span()), })); } - syn::GenericParam::Type(ref ty) => { + syn::GenericParam::Type(ty) => { if !ty.bounds.empty_or_trailing() { return syn::Error::new( gp.span(), diff --git a/hir-macros/src/operation.rs b/hir-macros/src/operation.rs index f8f526d7d..eeada23cb 100644 --- a/hir-macros/src/operation.rs +++ b/hir-macros/src/operation.rs @@ -1,12 +1,12 @@ use std::rc::Rc; use darling::{ - util::{Flag, SpannedValue}, Error, FromDeriveInput, FromField, FromMeta, + util::{Flag, SpannedValue}, }; use inflector::Inflector; -use quote::{format_ident, quote, ToTokens}; -use syn::{parse_quote, spanned::Spanned, Ident, Token}; +use quote::{ToTokens, format_ident, quote}; +use syn::{Ident, Token, parse_quote, spanned::Spanned}; pub fn derive_operation(input: syn::DeriveInput) -> darling::Result { let op = OpDefinition::from_derive_input(&input)?; @@ -136,7 +136,7 @@ impl OpDefinition { fn hydrate(&mut self, fields: darling::ast::Fields) -> darling::Result<()> { let named_fields = match &mut self.op.fields { - syn::Fields::Named(syn::FieldsNamed { ref mut named, .. }) => named, + syn::Fields::Named(syn::FieldsNamed { named, .. }) => named, _ => unreachable!(), }; let mut create_params = vec![]; @@ -232,7 +232,7 @@ impl OpDefinition { None => { self.operands.push(OpOperandGroup::Unnamed(vec![operand])); } - Some(OpOperandGroup::Unnamed(ref mut operands)) => { + Some(OpOperandGroup::Unnamed(operands)) => { operands.push(operand); } Some(OpOperandGroup::Named(..)) => { @@ -260,7 +260,7 @@ impl OpDefinition { None => { self.results = Some(OpResultGroup::Unnamed(vec![result])); } - Some(OpResultGroup::Unnamed(ref mut results)) => { + Some(OpResultGroup::Unnamed(results)) => { results.push(result); } Some(OpResultGroup::Named(..)) => { @@ -294,7 +294,7 @@ impl OpDefinition { None => { self.successors.push(SuccessorGroup::Unnamed(vec![field_name])); } - Some(SuccessorGroup::Unnamed(ref mut ids)) => { + Some(SuccessorGroup::Unnamed(ids)) => { ids.push(field_name); } Some(SuccessorGroup::Named(_) | SuccessorGroup::Keyed(..)) => { @@ -940,8 +940,8 @@ impl quote::ToTokens for OpSymbolFns<'_> { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { // Symbols for Symbol { - name: ref symbol, - ty: ref symbol_kind, + name: symbol, + ty: symbol_kind, } in self.0.symbols.iter() { let span = symbol.span(); @@ -1014,7 +1014,7 @@ impl quote::ToTokens for OpSymbolFns<'_> { }); let is_concrete_ty = match symbol_kind { - SymbolType::Concrete(ref ty) => [quote! { + SymbolType::Concrete(ty) => [quote! { // The way we check the type depends on whether `symbol` is a reference to `self` let (data_ptr, _) = ::midenc_hir::SymbolRef::as_ptr(&symbol).to_raw_parts(); if core::ptr::addr_eq(data_ptr, (self as *const Self as *const ())) { @@ -1093,8 +1093,8 @@ impl quote::ToTokens for OpAttrFns<'_> { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { // Attributes for OpAttribute { - name: ref attr, - ty: ref attr_ty, + name: attr, + ty: attr_ty, .. } in self.0.attrs.iter() { @@ -1155,12 +1155,8 @@ impl quote::ToTokens for OpOperandFns<'_> { match operand_group { // Operands OpOperandGroup::Unnamed(operands) => { - for ( - operand_index, - Operand { - name: ref operand, .. - }, - ) in operands.iter().enumerate() + for (operand_index, Operand { name: operand, .. }) in + operands.iter().enumerate() { let operand_index = syn::Lit::Int(syn::LitInt::new( &format!("{operand_index}usize"), @@ -1226,13 +1222,7 @@ impl quote::ToTokens for OpResultFns<'_> { if let Some(group) = self.0.results.as_ref() { match group { OpResultGroup::Unnamed(results) => { - for ( - index, - OpResult { - name: ref result, .. - }, - ) in results.iter().enumerate() - { + for (index, OpResult { name: result, .. }) in results.iter().enumerate() { let index = syn::Lit::Int(syn::LitInt::new( &format!("{index}usize"), result.span(), @@ -2078,7 +2068,7 @@ impl OperationFieldAttrs { match &attr.meta { // A bare #[attr], nothing to do syn::Meta::Path(_) => (), - syn::Meta::List(ref list) => { + syn::Meta::List(list) => { list.parse_nested_meta(|meta| { if meta.path.is_ident("hidden") { kind = Some(AttrKind::Hidden); @@ -2196,7 +2186,7 @@ impl OperationFieldAttrs { match &attr.meta { // A bare #[symbol], nothing to do syn::Meta::Path(_) => (), - syn::Meta::List(ref list) => { + syn::Meta::List(list) => { list.parse_nested_meta(|meta| { if meta.path.is_ident("callable") { symbol_ty = Some(SymbolType::Callable); diff --git a/hir/src/adt/arena.rs b/hir/src/adt/arena.rs index 02d850d1d..ebcdc1343 100644 --- a/hir/src/adt/arena.rs +++ b/hir/src/adt/arena.rs @@ -11,7 +11,7 @@ use core::{ sync::atomic::{AtomicUsize, Ordering}, }; -use intrusive_collections::{intrusive_adapter, LinkedListLink}; +use intrusive_collections::{LinkedListLink, intrusive_adapter}; use crate::adt::SizedTypeProperties; @@ -210,15 +210,15 @@ impl Iterator for IntoIter { impl Drop for IntoIter { fn drop(&mut self) { // Drop any items in the current chunk that we're responsible for dropping - if let Some(current_chunk) = self.current_chunk.take() { - if core::mem::needs_drop::() { - let ptr = current_chunk.data(); - while self.current_index < self.current_len { - unsafe { - let ptr = ptr.add(self.current_index); - core::ptr::drop_in_place(ptr.as_ptr()); - self.current_index += 1; - } + if let Some(current_chunk) = self.current_chunk.take() + && core::mem::needs_drop::() + { + let ptr = current_chunk.data(); + while self.current_index < self.current_len { + unsafe { + let ptr = ptr.add(self.current_index); + core::ptr::drop_in_place(ptr.as_ptr()); + self.current_index += 1; } } } diff --git a/hir/src/ir/callable.rs b/hir/src/ir/callable.rs index c76b08241..ba7f567d2 100644 --- a/hir/src/ir/callable.rs +++ b/hir/src/ir/callable.rs @@ -3,8 +3,8 @@ use core::fmt; use super::SymbolPathAttr; use crate::{ - formatter, CallConv, EntityRef, Op, OpOperandRange, OpOperandRangeMut, RegionRef, Symbol, - SymbolPath, SymbolRef, Type, UnsafeIntrusiveEntityRef, Value, ValueRef, Visibility, + CallConv, EntityRef, Op, OpOperandRange, OpOperandRangeMut, RegionRef, Symbol, SymbolPath, + SymbolRef, Type, UnsafeIntrusiveEntityRef, Value, ValueRef, Visibility, formatter, }; /// A call-like operation is one that transfers control from one function to another. @@ -124,14 +124,14 @@ impl Callable { pub fn as_symbol_path(&self) -> Option<&SymbolPath> { match self { - Self::Symbol(ref name) => Some(name), + Self::Symbol(name) => Some(name), _ => None, } } pub fn as_value(&self) -> Option> { match self { - Self::Value(ref value_ref) => Some(value_ref.borrow()), + Self::Value(value_ref) => Some(value_ref.borrow()), _ => None, } } @@ -351,9 +351,11 @@ impl Signature { /// Returns a slice containing the results of this function pub fn results(&self) -> &[AbiParam] { match self.results.as_slice() { - [AbiParam { - ty: Type::Never, .. - }] => &[], + [ + AbiParam { + ty: Type::Never, .. + }, + ] => &[], results => results, } } diff --git a/hir/src/ir/dominance/nca.rs b/hir/src/ir/dominance/nca.rs index c79e5643d..6c7cf5ca6 100644 --- a/hir/src/ir/dominance/nca.rs +++ b/hir/src/ir/dominance/nca.rs @@ -1,13 +1,13 @@ use alloc::{collections::BTreeMap, rc::Rc}; use core::cell::{Cell, Ref, RefCell}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use super::{DomTreeBase, DomTreeNode, DomTreeRoots}; use crate::{ + BlockRef, EntityId, EntityWithId, Region, cfg::{self, Graph, GraphDiff, Inverse}, formatter::{DisplayOptional, DisplayValues}, - BlockRef, EntityId, EntityWithId, Region, }; /// [SemiNCAInfo] provides functionality for constructing a dominator tree for a control-flow graph @@ -288,10 +288,10 @@ impl SemiNCA { self.batch_updates.as_ref(), ) }; - if let Some(succ_order) = succ_order { - if successors.len() > 1 { - successors.sort_by(|a, b| succ_order[a].cmp(&succ_order[b])); - } + if let Some(succ_order) = succ_order + && successors.len() > 1 + { + successors.sort_by(|a, b| succ_order[a].cmp(&succ_order[b])); } for succ in successors.into_iter().filter(|succ| condition(Some(block), Some(*succ))) { diff --git a/hir/src/ir/entity.rs b/hir/src/ir/entity.rs index 1eab88c38..54a627c19 100644 --- a/hir/src/ir/entity.rs +++ b/hir/src/ir/entity.rs @@ -289,7 +289,7 @@ impl RawEntityRef { #[inline] unsafe fn from_ptr(ptr: *mut RawEntityMetadata) -> Self { debug_assert!(!ptr.is_null()); - Self::from_inner(NonNull::new_unchecked(ptr)) + unsafe { Self::from_inner(NonNull::new_unchecked(ptr)) } } #[inline] diff --git a/hir/src/ir/entity/list.rs b/hir/src/ir/entity/list.rs index f42ef8330..6f2582248 100644 --- a/hir/src/ir/entity/list.rs +++ b/hir/src/ir/entity/list.rs @@ -386,7 +386,7 @@ where let parent = UnsafeIntrusiveEntityRef::into_raw(self.parent()).cast(); let raw = UnsafeIntrusiveEntityRef::into_inner(ptr).as_ptr(); EntityCursorMut { - cursor: self.list.cursor_mut_from_ptr(raw), + cursor: unsafe { self.list.cursor_mut_from_ptr(raw) }, parent, } } @@ -544,7 +544,7 @@ impl EntityList { &mut self, ptr: UnsafeIntrusiveEntityRef, ) -> EntityCursorMut<'_, T> { - >::cursor_mut_from_ptr(self, ptr) + unsafe { >::cursor_mut_from_ptr(self, ptr) } } /// Get an [EntityCursorMut] pointing to the first entity in the list, or the null object if @@ -1150,7 +1150,7 @@ impl RawEntityRef { #[inline] unsafe fn from_link_ptr(link: NonNull) -> Self { let offset = core::mem::offset_of!(RawEntityMetadata, metadata); - let ptr = link.byte_sub(offset).cast::>(); + let ptr = unsafe { link.byte_sub(offset).cast::>() }; Self { inner: ptr } } } @@ -1183,7 +1183,7 @@ unsafe impl intrusive_collections::PointerOps #[inline] unsafe fn from_raw(&self, value: *const Self::Value) -> Self::Pointer { debug_assert!(!value.is_null() && value.is_aligned()); - UnsafeIntrusiveEntityRef::from_ptr(value.cast_mut()) + unsafe { UnsafeIntrusiveEntityRef::from_ptr(value.cast_mut()) } } #[inline] @@ -1228,18 +1228,20 @@ unsafe impl intrusive_collections::Adapter for EntityAdapter { link: ::LinkPtr, ) -> *const ::Value { let offset = core::mem::offset_of!(IntrusiveLink, link); - let link_ptr = link.byte_sub(offset).cast::(); - let raw_entity_ref = UnsafeIntrusiveEntityRef::::from_link_ptr(link_ptr); - raw_entity_ref.inner.as_ptr().cast_const() + unsafe { + let link_ptr = link.byte_sub(offset).cast::(); + let raw_entity_ref = UnsafeIntrusiveEntityRef::::from_link_ptr(link_ptr); + raw_entity_ref.inner.as_ptr().cast_const() + } } unsafe fn get_link( &self, value: *const ::Value, ) -> ::LinkPtr { - let raw_entity_ref = UnsafeIntrusiveEntityRef::from_ptr(value.cast_mut()); + let raw_entity_ref = unsafe { UnsafeIntrusiveEntityRef::from_ptr(value.cast_mut()) }; let offset = RawEntityMetadata::::metadata_offset(); - raw_entity_ref.inner.byte_add(offset).cast() + unsafe { raw_entity_ref.inner.byte_add(offset).cast() } } fn link_ops(&self) -> &Self::LinkOps { diff --git a/hir/src/ir/immediates.rs b/hir/src/ir/immediates.rs index 1a913fb49..ba20de1fc 100644 --- a/hir/src/ir/immediates.rs +++ b/hir/src/ir/immediates.rs @@ -5,7 +5,7 @@ use core::{ pub use miden_core::{Felt, FieldElement, StarkField}; -use crate::{formatter::PrettyPrint, Type}; +use crate::{Type, formatter::PrettyPrint}; #[derive(Debug, Copy, Clone)] pub enum Immediate { @@ -816,7 +816,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> i8 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -835,7 +835,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> u8 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -854,7 +854,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> i16 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -873,7 +873,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> u16 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -892,7 +892,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> i32 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -911,7 +911,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> u32 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -930,7 +930,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> i64 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -949,7 +949,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> u64 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -968,7 +968,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> Felt { - Felt::new(f64::to_int_unchecked::(self)) + Felt::new(unsafe { f64::to_int_unchecked::(self) }) } } impl FloatToInt for f64 { @@ -987,7 +987,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> u128 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } impl FloatToInt for f64 { @@ -1006,7 +1006,7 @@ impl FloatToInt for f64 { } unsafe fn to_int_unchecked(self) -> i128 { - f64::to_int_unchecked(self) + unsafe { f64::to_int_unchecked(self) } } } diff --git a/hir/src/ir/loops.rs b/hir/src/ir/loops.rs index 394e9ec8d..41720b3d5 100644 --- a/hir/src/ir/loops.rs +++ b/hir/src/ir/loops.rs @@ -7,14 +7,14 @@ use core::{ use smallvec::SmallVec; use super::{ - dominance::{DominanceInfo, DominanceTree, PostOrderDomTreeIter}, RegionKindInterface, RegionRef, + dominance::{DominanceInfo, DominanceTree, PostOrderDomTreeIter}, }; use crate::{ + BlockRef, Operation, OperationRef, PostOrderBlockIter, Report, adt::{SmallDenseMap, SmallSet}, cfg::{Graph, Inverse, InvertibleGraph}, pass::Analysis, - BlockRef, Operation, OperationRef, PostOrderBlockIter, Report, }; /// Represents the results of analyzing an [Operation] and computing the [LoopForest] for each of @@ -509,7 +509,7 @@ impl LoopForest { None => { return Err(Report::msg( "top level loop is missing in computed loop forest", - )) + )); } Some(other_l) => { // Recursively compare the loops @@ -1267,10 +1267,10 @@ impl Loop { } // Check the parent loop pointer. - if let Some(parent) = self.parent_loop() { - if !parent.nested().contains(&parent) { - return Err(Report::msg("loop is not a subloop of its parent")); - } + if let Some(parent) = self.parent_loop() + && !parent.nested().contains(&parent) + { + return Err(Report::msg("loop is not a subloop of its parent")); } Ok(()) diff --git a/hir/src/ir/operation.rs b/hir/src/ir/operation.rs index 036bcf658..febb39bef 100644 --- a/hir/src/ir/operation.rs +++ b/hir/src/ir/operation.rs @@ -17,7 +17,7 @@ use super::{ *, }; use crate::{ - adt::SmallSet, patterns::RewritePatternSet, AttributeSet, AttributeValue, Forward, ProgramPoint, + AttributeSet, AttributeValue, Forward, ProgramPoint, adt::SmallSet, patterns::RewritePatternSet, }; pub type OperationRef = UnsafeIntrusiveEntityRef; @@ -184,27 +184,27 @@ impl EntityListItem for Operation { // NOTE: We use OperationName, instead of the Operation itself, to avoid borrowing. if this.name().implements::() { let parent = this.nearest_symbol_table(); - if let Some(mut parent) = parent { - if parent.name().implements::() { - // NOTE: We call `unwrap()` here because we are confident that these function calls - // are valid thanks to the `implements` check above. - let mut symbol_table = parent.borrow_mut(); - let sym_manager = symbol_table.as_trait_mut::().unwrap(); - let mut sym_manager = sym_manager.symbol_manager_mut(); - - let symbol_ref = this.borrow().as_symbol_ref().unwrap(); - - let is_new = sym_manager.insert_new(symbol_ref, ProgramPoint::Invalid); - assert!( - is_new, - "Unable to insert {} in symbol table of {}: symbol {} is already \ - registered to another operation {}.", - this.name(), - parent.name(), - symbol_ref.borrow().name(), - sym_manager.lookup(symbol_ref.borrow().name()).unwrap().borrow().name() - ); - } + if let Some(mut parent) = parent + && parent.name().implements::() + { + // NOTE: We call `unwrap()` here because we are confident that these function calls + // are valid thanks to the `implements` check above. + let mut symbol_table = parent.borrow_mut(); + let sym_manager = symbol_table.as_trait_mut::().unwrap(); + let mut sym_manager = sym_manager.symbol_manager_mut(); + + let symbol_ref = this.borrow().as_symbol_ref().unwrap(); + + let is_new = sym_manager.insert_new(symbol_ref, ProgramPoint::Invalid); + assert!( + is_new, + "Unable to insert {} in symbol table of {}: symbol {} is already registered \ + to another operation {}.", + this.name(), + parent.name(), + symbol_ref.borrow().name(), + sym_manager.lookup(symbol_ref.borrow().name()).unwrap().borrow().name() + ); } } let order_offset = core::mem::offset_of!(Operation, order); diff --git a/hir/src/ir/operation/name.rs b/hir/src/ir/operation/name.rs index 087856466..f44df914a 100644 --- a/hir/src/ir/operation/name.rs +++ b/hir/src/ir/operation/name.rs @@ -7,10 +7,9 @@ use core::{ use super::OpRegistration; use crate::{ - interner, + Context, interner, patterns::RewritePatternSet, traits::{Canonicalizable, TraitInfo}, - Context, }; /// The operation name, or mnemonic, that uniquely identifies an operation. @@ -113,7 +112,7 @@ impl OperationName { #[inline(always)] unsafe fn downcast_ref_unchecked(&self, ptr: *const ()) -> &T { - &*core::ptr::from_raw_parts(ptr.cast::(), ()) + unsafe { &*core::ptr::from_raw_parts(ptr.cast::(), ()) } } #[inline] @@ -127,7 +126,7 @@ impl OperationName { #[inline(always)] unsafe fn downcast_mut_unchecked(&mut self, ptr: *mut ()) -> &mut T { - &mut *core::ptr::from_raw_parts_mut(ptr.cast::(), ()) + unsafe { &mut *core::ptr::from_raw_parts_mut(ptr.cast::(), ()) } } pub(super) fn upcast(&self, ptr: *const ()) -> Option<&Trait> diff --git a/hir/src/ir/region/branch_point.rs b/hir/src/ir/region/branch_point.rs index d89b9d5dc..1776e1300 100644 --- a/hir/src/ir/region/branch_point.rs +++ b/hir/src/ir/region/branch_point.rs @@ -19,7 +19,7 @@ impl fmt::Display for RegionBranchPoint { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Parent => f.write_str("parent"), - Self::Child(ref region) => { + Self::Child(region) => { write!(f, "child({})", region.borrow().region_number()) } } @@ -29,7 +29,7 @@ impl fmt::Debug for RegionBranchPoint { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Parent => f.write_str("Parent"), - Self::Child(ref region) => { + Self::Child(region) => { f.debug_tuple("Child").field(&format_args!("{region:p}")).finish() } } diff --git a/hir/src/ir/region/transforms/dce.rs b/hir/src/ir/region/transforms/dce.rs index 56d1a9817..9ca6ec6e7 100644 --- a/hir/src/ir/region/transforms/dce.rs +++ b/hir/src/ir/region/transforms/dce.rs @@ -4,10 +4,10 @@ use smallvec::SmallVec; use super::RegionTransformFailed; use crate::{ - adt::SmallSet, - traits::{BranchOpInterface, Terminator}, OpOperandImpl, OpResult, Operation, OperationRef, PostOrderBlockIter, Region, RegionRef, Rewriter, SuccessorOperands, ValueRef, + adt::SmallSet, + traits::{BranchOpInterface, Terminator}, }; /// Data structure used to track which values have already been proved live. @@ -77,14 +77,11 @@ impl LiveMap { // than to the terminator op itself, a terminator op can't e.g. "print" the value of a // successor operand. let owner = &user.owner; - if owner.borrow().implements::() { - if let Some(branch_interface) = owner.borrow().as_trait::() { - if let Some(arg) = - branch_interface.get_successor_block_argument(user.index as usize) - { - return !self.was_proven_live(&arg.upcast()); - } - } + if owner.borrow().implements::() + && let Some(branch_interface) = owner.borrow().as_trait::() + && let Some(arg) = branch_interface.get_successor_block_argument(user.index as usize) + { + return !self.was_proven_live(&arg.upcast()); } false diff --git a/hir/src/ir/region/transforms/drop_redundant_args.rs b/hir/src/ir/region/transforms/drop_redundant_args.rs index 4c95a95dc..fc0c313b5 100644 --- a/hir/src/ir/region/transforms/drop_redundant_args.rs +++ b/hir/src/ir/region/transforms/drop_redundant_args.rs @@ -2,8 +2,8 @@ use smallvec::SmallVec; use super::RegionTransformFailed; use crate::{ - traits::BranchOpInterface, BlockArgumentRef, BlockRef, Region, RegionRef, Rewriter, - SuccessorOperands, Usable, + BlockArgumentRef, BlockRef, Region, RegionRef, Rewriter, SuccessorOperands, Usable, + traits::BranchOpInterface, }; impl Region { @@ -112,13 +112,13 @@ impl Region { } // If they are passing the same value, drop the argument. - if let Some(common_value) = common_value { - if same_arg { - args_to_erase.push(arg_index); + if let Some(common_value) = common_value + && same_arg + { + args_to_erase.push(arg_index); - // Remove the argument from the block. - rewriter.replace_all_uses_of_value_with(block_arg, common_value); - } + // Remove the argument from the block. + rewriter.replace_all_uses_of_value_with(block_arg, common_value); } } diff --git a/hir/src/ir/successor.rs b/hir/src/ir/successor.rs index 0d60bc82e..27882e1a5 100644 --- a/hir/src/ir/successor.rs +++ b/hir/src/ir/successor.rs @@ -299,7 +299,9 @@ impl crate::StorableEntity for SuccessorInfo { #[inline(always)] unsafe fn set_index(&mut self, index: usize) { - self.block.set_index(index); + unsafe { + self.block.set_index(index); + } } #[inline(always)] diff --git a/hir/src/ir/symbols.rs b/hir/src/ir/symbols.rs index 74ec6f22f..cc4e8548c 100644 --- a/hir/src/ir/symbols.rs +++ b/hir/src/ir/symbols.rs @@ -8,7 +8,7 @@ mod table; use alloc::{collections::VecDeque, format, vec}; -use midenc_session::diagnostics::{miette, Diagnostic}; +use midenc_session::diagnostics::{Diagnostic, miette}; use smallvec::SmallVec; pub use self::{ @@ -161,10 +161,10 @@ impl Operation { /// /// Returns `None` if the symbol is not found. pub fn nearest_symbol(&self, symbol: SymbolName) -> Option { - if let Some(sym) = self.as_symbol() { - if sym.name() == symbol { - return Some(unsafe { UnsafeIntrusiveEntityRef::from_raw(sym) }); - } + if let Some(sym) = self.as_symbol() + && sym.name() == symbol + { + return Some(unsafe { UnsafeIntrusiveEntityRef::from_raw(sym) }); } let symbol_table_op = self.nearest_symbol_table()?; let op = symbol_table_op.borrow(); diff --git a/hir/src/ir/symbols/path.rs b/hir/src/ir/symbols/path.rs index 79293b9a1..dcdd3cc4d 100644 --- a/hir/src/ir/symbols/path.rs +++ b/hir/src/ir/symbols/path.rs @@ -1,11 +1,11 @@ use alloc::{borrow::Cow, collections::VecDeque, format}; use core::fmt; -use midenc_session::diagnostics::{miette, Diagnostic}; -use smallvec::{smallvec, SmallVec}; +use midenc_session::diagnostics::{Diagnostic, miette}; +use smallvec::{SmallVec, smallvec}; use super::SymbolUseRef; -use crate::{define_attr_type, interner, FunctionIdent, SymbolName}; +use crate::{FunctionIdent, SymbolName, define_attr_type, interner}; #[derive(Debug, thiserror::Error, Diagnostic)] pub enum InvalidSymbolPathError { @@ -241,7 +241,7 @@ impl SymbolPath { /// Set the value of the leaf component of the path, or append it if not yet present pub fn set_name(&mut self, name: SymbolName) { match self.path.last_mut() { - Some(SymbolNameComponent::Leaf(ref mut prev_name)) => { + Some(SymbolNameComponent::Leaf(prev_name)) => { *prev_name = name; } _ => { @@ -268,8 +268,8 @@ impl SymbolPath { /// Derive a Miden Assembly `LibraryPath` from this symbol path pub fn to_library_path(&self) -> midenc_session::LibraryPath { use midenc_session::{ - miden_assembly::{ast::Ident, SourceSpan, Span}, LibraryNamespace, LibraryPath, + miden_assembly::{SourceSpan, Span, ast::Ident}, }; let mut components = self.path.iter(); diff --git a/hir/src/ir/symbols/table.rs b/hir/src/ir/symbols/table.rs index 53caba022..2e6b1ae06 100644 --- a/hir/src/ir/symbols/table.rs +++ b/hir/src/ir/symbols/table.rs @@ -1,10 +1,10 @@ use super::{ - generate_symbol_name, Symbol, SymbolName, SymbolNameComponent, SymbolPath, SymbolPathAttr, - SymbolRef, + Symbol, SymbolName, SymbolNameComponent, SymbolPath, SymbolPathAttr, SymbolRef, + generate_symbol_name, }; use crate::{ - traits::{GraphRegionNoTerminator, NoTerminator, Terminator}, FxHashMap, Op, Operation, OperationRef, ProgramPoint, Report, UnsafeIntrusiveEntityRef, + traits::{GraphRegionNoTerminator, NoTerminator, Terminator}, }; /// A type alias for [SymbolTable] implementations referenced via [UnsafeIntrusiveEntityRef] @@ -365,7 +365,7 @@ impl core::ops::Deref for Symbols<'_> { fn deref(&self) -> &Self::Target { match self { - Self::Owned(ref symbols) => symbols, + Self::Owned(symbols) => symbols, Self::Borrowed(symbols) => symbols, } } @@ -390,7 +390,7 @@ impl core::ops::Deref for SymbolsMut<'_> { fn deref(&self) -> &Self::Target { match self { - Self::Owned(ref symbols) => symbols, + Self::Owned(symbols) => symbols, Self::Borrowed(symbols) => symbols, } } diff --git a/hir/src/ir/traits/foldable.rs b/hir/src/ir/traits/foldable.rs index e58a3b45a..b18182c04 100644 --- a/hir/src/ir/traits/foldable.rs +++ b/hir/src/ir/traits/foldable.rs @@ -147,7 +147,7 @@ impl core::fmt::Debug for OpFoldResult { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::Attribute(attr) => core::fmt::Debug::fmt(attr, f), - Self::Value(ref value) => write!(f, "{}", value.borrow().id()), + Self::Value(value) => write!(f, "{}", value.borrow().id()), } } } diff --git a/hir/src/ir/traits/info.rs b/hir/src/ir/traits/info.rs index 38064f8bb..e340b83c8 100644 --- a/hir/src/ir/traits/info.rs +++ b/hir/src/ir/traits/info.rs @@ -1,7 +1,7 @@ use core::{ any::{Any, TypeId}, marker::Unsize, - ptr::{null, DynMetadata, Pointee}, + ptr::{DynMetadata, Pointee, null}, }; #[doc(hidden)] @@ -53,7 +53,7 @@ impl TraitInfo { Trait: ?Sized + Pointee> + 'static, { debug_assert!(self.type_id == TypeId::of::()); - core::mem::transmute(self.metadata) + unsafe { core::mem::transmute(self.metadata) } } } impl Eq for TraitInfo {} diff --git a/hir/src/pass/manager.rs b/hir/src/pass/manager.rs index 389411c2b..afdd0b78b 100644 --- a/hir/src/pass/manager.rs +++ b/hir/src/pass/manager.rs @@ -7,18 +7,18 @@ use alloc::{ }; use compact_str::{CompactString, ToCompactString}; -use midenc_session::{diagnostics::Severity, Options}; -use smallvec::{smallvec, SmallVec}; +use midenc_session::{Options, diagnostics::Severity}; +use smallvec::{SmallVec, smallvec}; use super::{ AnalysisManager, OperationPass, Pass, PassExecutionState, PassInstrumentation, PassInstrumentor, PipelineParentInfo, Statistic, }; use crate::{ - pass::{PostPassStatus, Print}, - traits::IsolatedFromAbove, Context, EntityMut, OpPrintingFlags, OpRegistration, Operation, OperationName, OperationRef, Report, + pass::{PostPassStatus, Print}, + traits::IsolatedFromAbove, }; #[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] @@ -119,19 +119,19 @@ impl PassManager { let op_name = op.borrow().name(); let anchor = self.pm.name(); - if let Some(anchor) = anchor { - if anchor != &op_name { - return Err(self - .context - .diagnostics() - .diagnostic(Severity::Error) - .with_message("failed to construct pass manager") - .with_primary_label( - op.borrow().span(), - format!("can't run '{anchor}' pass manager on '{op_name}'"), - ) - .into_report()); - } + if let Some(anchor) = anchor + && anchor != &op_name + { + return Err(self + .context + .diagnostics() + .diagnostic(Severity::Error) + .with_message("failed to construct pass manager") + .with_primary_label( + op.borrow().span(), + format!("can't run '{anchor}' pass manager on '{op_name}'"), + ) + .into_report()); } // Register all dialects for the current pipeline. @@ -401,20 +401,20 @@ impl OpPassManager { // If this pass runs on a different operation than this pass manager, then implicitly // nest a pass manager for this operation if enabled. let pass_op_name = pass.target_name(&self.context); - if let Some(pass_op_name) = pass_op_name { - if self.name.as_ref().is_some_and(|name| name != &pass_op_name) { - if matches!(self.nesting, Nesting::Implicit) { - let mut nested = self.nest_for(pass_op_name); - nested.add_pass(pass); - return; - } - panic!( - "cannot add pass '{}' restricted to '{pass_op_name}' to a pass manager \ - intended to run on '{}', did you intend to nest?", - pass.name(), - self.name().unwrap(), - ); + if let Some(pass_op_name) = pass_op_name + && self.name.as_ref().is_some_and(|name| name != &pass_op_name) + { + if matches!(self.nesting, Nesting::Implicit) { + let mut nested = self.nest_for(pass_op_name); + nested.add_pass(pass); + return; } + panic!( + "cannot add pass '{}' restricted to '{pass_op_name}' to a pass manager intended \ + to run on '{}', did you intend to nest?", + pass.name(), + self.name().unwrap(), + ); } self.passes.push(pass); @@ -991,10 +991,10 @@ impl OpToOpPassAdaptor { // * If the pass said that it preserved all analyses then it can't have permuted the IR let run_verifier_now = !execution_state.preserved_analyses().is_all(); - if run_verifier_now { - if let Err(verification_result) = Self::verify(&op, run_verifier_recursively) { - result = result.map_err(|_| verification_result); - } + if run_verifier_now + && let Err(verification_result) = Self::verify(&op, run_verifier_recursively) + { + result = result.map_err(|_| verification_result); } } diff --git a/hir/src/patterns/pattern_set.rs b/hir/src/patterns/pattern_set.rs index da72289c9..ad19bef0d 100644 --- a/hir/src/patterns/pattern_set.rs +++ b/hir/src/patterns/pattern_set.rs @@ -75,7 +75,7 @@ impl FrozenRewritePatternSet { .push(Rc::clone(&pattern)); this.patterns.push(pattern); } - PatternKind::Trait(ref trait_id) => { + PatternKind::Trait(trait_id) => { for dialect in this.context.registered_dialects().values() { for op in dialect.registered_ops().iter() { if op.implements_trait_id(trait_id) { diff --git a/hir/src/patterns/rewriter.rs b/hir/src/patterns/rewriter.rs index 05de52388..97c9f9e46 100644 --- a/hir/src/patterns/rewriter.rs +++ b/hir/src/patterns/rewriter.rs @@ -4,9 +4,9 @@ use core::ops::{Deref, DerefMut}; use smallvec::SmallVec; use crate::{ - patterns::Pattern, BlockRef, Builder, Context, InsertionGuard, Listener, ListenerType, - OpBuilder, OpOperandImpl, OperationRef, PostOrderBlockIter, ProgramPoint, RegionRef, Report, - SourceSpan, Usable, ValueRef, + BlockRef, Builder, Context, InsertionGuard, Listener, ListenerType, OpBuilder, OpOperandImpl, + OperationRef, PostOrderBlockIter, ProgramPoint, RegionRef, Report, SourceSpan, Usable, + ValueRef, patterns::Pattern, }; /// A [Rewriter] is a [Builder] extended with additional functionality that is of primary use when @@ -66,13 +66,10 @@ pub trait Rewriter: Builder + RewriterListener { // All nested ops should have been erased already assert!(op.regions().iter().all(|r| r.is_empty()), "expected empty regions"); // All users should have been erased already if the op is in a region with SSA dominance - if op.is_used() { - if let Some(region) = op.parent_region() { - assert!( - region.borrow().may_be_graph_region(), - "expected that op has no uses" - ); - } + if op.is_used() + && let Some(region) = op.parent_region() + { + assert!(region.borrow().may_be_graph_region(), "expected that op has no uses"); } } diff --git a/hir/src/program_point.rs b/hir/src/program_point.rs index 23b945123..c8b61ff01 100644 --- a/hir/src/program_point.rs +++ b/hir/src/program_point.rs @@ -1,9 +1,9 @@ use core::fmt; use crate::{ - entity::{EntityProjection, EntityProjectionMut}, Block, BlockRef, EntityCursor, EntityCursorMut, EntityMut, EntityRef, Operation, OperationRef, Spanned, + entity::{EntityProjection, EntityProjectionMut}, }; /// [ProgramPoint] represents a specific location in the execution of a program. @@ -147,12 +147,10 @@ impl ProgramPoint { match &mut pp { Self::Invalid => (), Self::Op { - position: ref mut point, - .. + position: point, .. } | Self::Block { - position: ref mut point, - .. + position: point, .. } => { *point = Position::After; } diff --git a/midenc-session/src/inputs.rs b/midenc-session/src/inputs.rs index 29dbe6eab..4f24df166 100644 --- a/midenc-session/src/inputs.rs +++ b/midenc-session/src/inputs.rs @@ -177,14 +177,14 @@ impl InputFile { pub fn file_name(&self) -> FileName { match &self.file { - InputType::Real(ref path) => path.clone().into(), + InputType::Real(path) => path.clone().into(), InputType::Stdin { name, .. } => name.clone(), } } pub fn as_path(&self) -> Option<&Path> { match &self.file { - InputType::Real(ref path) => Some(path), + InputType::Real(path) => Some(path), _ => None, } } @@ -195,7 +195,7 @@ impl InputFile { pub fn filestem(&self) -> &str { match &self.file { - InputType::Real(ref path) => path.file_stem().unwrap().to_str().unwrap(), + InputType::Real(path) => path.file_stem().unwrap().to_str().unwrap(), InputType::Stdin { .. } => "noname", } } diff --git a/midenc-session/src/lib.rs b/midenc-session/src/lib.rs index 7b5b551fa..0015f0579 100644 --- a/midenc-session/src/lib.rs +++ b/midenc-session/src/lib.rs @@ -51,8 +51,8 @@ pub use self::{ flags::{ArgMatches, CompileFlag, CompileFlags, FlagAction}, inputs::{FileName, FileType, InputFile, InputType, InvalidInputError}, libs::{ - add_target_link_libraries, LibraryKind, LibraryNamespace, LibraryPath, - LibraryPathComponent, LinkLibrary, STDLIB, + LibraryKind, LibraryNamespace, LibraryPath, LibraryPathComponent, LinkLibrary, STDLIB, + add_target_link_libraries, }, options::*, outputs::{OutputFile, OutputFiles, OutputMode, OutputType, OutputTypeSpec, OutputTypes}, @@ -203,7 +203,7 @@ impl Session { log::debug!(target: "driver", "unable to derive name from output file, deriving from input"); match inputs.first() { Some(InputFile { - file: InputType::Real(ref path), + file: InputType::Real(path), .. }) => path .file_stem() @@ -218,7 +218,7 @@ impl Session { .to_string(), Some( input @ InputFile { - file: InputType::Stdin { ref name, .. }, + file: InputType::Stdin { name, .. }, .. }, ) => { @@ -324,13 +324,10 @@ impl Session { #[cfg(feature = "std")] fn check_file_is_writeable(&self, file: &Path) { - if let Ok(m) = file.metadata() { - if m.permissions().readonly() { - panic!( - "Compiler exited with a fatal error: file is not writeable: {}", - file.display() - ); - } + if let Ok(m) = file.metadata() + && m.permissions().readonly() + { + panic!("Compiler exited with a fatal error: file is not writeable: {}", file.display()); } } diff --git a/midenc-session/src/outputs.rs b/midenc-session/src/outputs.rs index ed75cdf1a..b9e45138b 100644 --- a/midenc-session/src/outputs.rs +++ b/midenc-session/src/outputs.rs @@ -111,14 +111,14 @@ pub enum OutputFile { impl OutputFile { pub fn parent(&self) -> Option<&Path> { match self { - Self::Real(ref path) => path.parent(), + Self::Real(path) => path.parent(), Self::Stdout => None, } } pub fn filestem(&self) -> Option> { match self { - Self::Real(ref path) => path.file_stem().map(|stem| stem.to_string_lossy()), + Self::Real(path) => path.file_stem().map(|stem| stem.to_string_lossy()), Self::Stdout => None, } } @@ -143,7 +143,7 @@ impl OutputFile { pub fn as_path(&self) -> Option<&Path> { match self { - Self::Real(ref path) => Some(path.as_ref()), + Self::Real(path) => Some(path.as_ref()), Self::Stdout => None, } } @@ -155,7 +155,7 @@ impl OutputFile { name: Option<&str>, ) -> PathBuf { match self { - Self::Real(ref path) => path.clone(), + Self::Real(path) => path.clone(), Self::Stdout => outputs.temp_path(ty, name), } } @@ -163,7 +163,7 @@ impl OutputFile { impl fmt::Display for OutputFile { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Self::Real(ref path) => write!(f, "{}", path.display()), + Self::Real(path) => write!(f, "{}", path.display()), Self::Stdout => write!(f, "stdout"), } } @@ -285,7 +285,7 @@ impl OutputFiles { /// * Otherwise, calls [with_directory_and_extension] with `self.out_dir` and `extension` pub fn with_extension(&self, extension: &str) -> PathBuf { match self.out_file.as_ref() { - Some(OutputFile::Real(ref path)) => path.with_extension(extension), + Some(OutputFile::Real(path)) => path.with_extension(extension), Some(OutputFile::Stdout) | None => { self.with_directory_and_extension(&self.out_dir, extension) } @@ -316,13 +316,13 @@ impl OutputTypes { "--emit=all cannot be combined with other --emit types", )); } - if let Some(OutputFile::Real(ref path)) = &path { - if path.extension().is_some() { - return Err(clap::Error::raw( - clap::error::ErrorKind::ValueValidation, - "invalid path for --emit=all: must be a directory", - )); - } + 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() { map.insert(ty, path.clone()); diff --git a/rustfmt.toml b/rustfmt.toml index bda0a2327..62dfa181e 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,4 +1,4 @@ -edition = "2021" +edition = "2024" array_width = 80 chain_width = 80 comment_width = 100 diff --git a/sdk/alloc/build.rs b/sdk/alloc/build.rs index 4dd8fda21..43a2f7015 100644 --- a/sdk/alloc/build.rs +++ b/sdk/alloc/build.rs @@ -40,7 +40,7 @@ fn main() { let status = Command::new("rustc") .arg("--crate-name") .arg("miden_alloc_heap_base_stub") - .arg("--edition=2021") + .arg("--edition=2024") .arg("--crate-type=rlib") .arg("--target") .arg(&target) diff --git a/sdk/alloc/src/lib.rs b/sdk/alloc/src/lib.rs index 37d789f01..11e2e793d 100644 --- a/sdk/alloc/src/lib.rs +++ b/sdk/alloc/src/lib.rs @@ -95,10 +95,12 @@ unsafe impl GlobalAlloc for BumpAlloc { self.maybe_init(); let top = self.top.load(Ordering::Relaxed); - let available = HEAP_END.byte_offset_from(top) as usize; + let available = unsafe { HEAP_END.byte_offset_from(top) as usize }; if available >= size { - self.top.store(top.byte_add(size), Ordering::Relaxed); - unsafe { top.byte_offset(align as isize) } + unsafe { + self.top.store(top.byte_add(size), Ordering::Relaxed); + top.byte_offset(align as isize) + } } else { null_mut() } @@ -125,7 +127,7 @@ unsafe impl GlobalAlloc for BumpAlloc { } #[cfg(target_family = "wasm")] -extern "C" { +unsafe extern "C" { #[link_name = "intrinsics::mem::heap_base"] fn heap_base() -> *mut u8; } diff --git a/sdk/alloc/stubs/heap_base.rs b/sdk/alloc/stubs/heap_base.rs index 54789a1da..9f39a5f79 100644 --- a/sdk/alloc/stubs/heap_base.rs +++ b/sdk/alloc/stubs/heap_base.rs @@ -3,8 +3,7 @@ // Provide a local definition for the allocator to link against, and export it // under the MASM intrinsic path so the frontend recognizes and lowers it. -#[export_name = "intrinsics::mem::heap_base"] +#[unsafe(export_name = "intrinsics::mem::heap_base")] pub extern "C" fn __intrinsics_mem_heap_base_stub() -> *mut u8 { unsafe { core::hint::unreachable_unchecked() } } - diff --git a/sdk/base-macros/src/component_macro/mod.rs b/sdk/base-macros/src/component_macro/mod.rs index 9455f8196..f294d15b4 100644 --- a/sdk/base-macros/src/component_macro/mod.rs +++ b/sdk/base-macros/src/component_macro/mod.rs @@ -10,8 +10,8 @@ use proc_macro::Span; use proc_macro2::{Ident, Literal, TokenStream as TokenStream2}; use quote::{format_ident, quote}; use syn::{ - spanned::Spanned, Attribute, FnArg, ImplItem, ImplItemFn, ItemImpl, ItemStruct, ReturnType, - Type, Visibility, + Attribute, FnArg, ImplItem, ImplItemFn, ItemImpl, ItemStruct, ReturnType, Type, Visibility, + spanned::Spanned, }; use crate::{ @@ -23,7 +23,7 @@ use crate::{ storage::process_storage_fields, }, types::{ - map_type_to_type_ref, registered_export_types, ExportedTypeDef, ExportedTypeKind, TypeRef, + ExportedTypeDef, ExportedTypeKind, TypeRef, map_type_to_type_ref, registered_export_types, }, }; @@ -480,14 +480,13 @@ fn record_type_path( // Give single-segment paths a module prefix so we don't generate bare identifiers that fail to // resolve outside the component module. - if segments.len() <= 1 { - if let Some(last) = segments.last().cloned() { - if let Some(prefix) = module_prefix_segments { - let mut resolved = prefix.to_vec(); - resolved.push(last); - segments = resolved; - } - } + if segments.len() <= 1 + && let Some(last) = segments.last().cloned() + && let Some(prefix) = module_prefix_segments + { + let mut resolved = prefix.to_vec(); + resolved.push(last); + segments = resolved; } paths.entry(type_ref.wit_name.clone()).or_insert(segments); diff --git a/sdk/base-sys/build.rs b/sdk/base-sys/build.rs index a98c91dd9..0377be1c1 100644 --- a/sdk/base-sys/build.rs +++ b/sdk/base-sys/build.rs @@ -78,7 +78,7 @@ fn main() { let status = Command::new("rustc") .arg("--crate-name") .arg("miden_base_sys_stubs") - .arg("--edition=2021") + .arg("--edition=2024") .arg("--crate-type=rlib") .arg("--target") .arg(&target) diff --git a/sdk/base-sys/src/bindings/active_account.rs b/sdk/base-sys/src/bindings/active_account.rs index 1528261b1..d567c8ed3 100644 --- a/sdk/base-sys/src/bindings/active_account.rs +++ b/sdk/base-sys/src/bindings/active_account.rs @@ -3,7 +3,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::types::{AccountId, Asset}; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::active_account::get_id"] fn extern_active_account_get_id(ptr: *mut AccountId); #[link_name = "miden::active_account::get_nonce"] diff --git a/sdk/base-sys/src/bindings/active_note.rs b/sdk/base-sys/src/bindings/active_note.rs index 89bdbafc6..3e89b0325 100644 --- a/sdk/base-sys/src/bindings/active_note.rs +++ b/sdk/base-sys/src/bindings/active_note.rs @@ -6,7 +6,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::{AccountId, Asset, Recipient}; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::active_note::get_inputs"] pub fn extern_note_get_inputs(ptr: *mut Felt) -> usize; #[link_name = "miden::active_note::get_assets"] diff --git a/sdk/base-sys/src/bindings/asset.rs b/sdk/base-sys/src/bindings/asset.rs index fa8ce7fbb..56954e992 100644 --- a/sdk/base-sys/src/bindings/asset.rs +++ b/sdk/base-sys/src/bindings/asset.rs @@ -3,7 +3,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::types::{AccountId, Asset}; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::asset::build_fungible_asset"] pub fn extern_asset_build_fungible_asset( faucet_id_prefix: Felt, diff --git a/sdk/base-sys/src/bindings/faucet.rs b/sdk/base-sys/src/bindings/faucet.rs index 8bea9ce9e..d42b2fee7 100644 --- a/sdk/base-sys/src/bindings/faucet.rs +++ b/sdk/base-sys/src/bindings/faucet.rs @@ -3,7 +3,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::types::Asset; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::faucet::create_fungible_asset"] pub fn extern_faucet_create_fungible_asset(amount: Felt, ptr: *mut Asset); diff --git a/sdk/base-sys/src/bindings/input_note.rs b/sdk/base-sys/src/bindings/input_note.rs index d760666ef..52d34e6db 100644 --- a/sdk/base-sys/src/bindings/input_note.rs +++ b/sdk/base-sys/src/bindings/input_note.rs @@ -6,7 +6,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::types::{AccountId, Asset, NoteIdx, Recipient}; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::input_note::get_assets_info"] pub fn extern_input_note_get_assets_info(note_index: Felt, ptr: *mut (Word, Felt)); diff --git a/sdk/base-sys/src/bindings/native_account.rs b/sdk/base-sys/src/bindings/native_account.rs index 99f5d94c1..c47df1e23 100644 --- a/sdk/base-sys/src/bindings/native_account.rs +++ b/sdk/base-sys/src/bindings/native_account.rs @@ -3,7 +3,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::types::Asset; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::native_account::add_asset"] fn extern_native_account_add_asset( asset_3: Felt, diff --git a/sdk/base-sys/src/bindings/output_note.rs b/sdk/base-sys/src/bindings/output_note.rs index 2463d2528..03cbbc81a 100644 --- a/sdk/base-sys/src/bindings/output_note.rs +++ b/sdk/base-sys/src/bindings/output_note.rs @@ -6,7 +6,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::types::{Asset, NoteIdx, NoteType, Recipient, Tag}; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::output_note::create"] pub fn extern_output_note_create( tag: Tag, diff --git a/sdk/base-sys/src/bindings/storage.rs b/sdk/base-sys/src/bindings/storage.rs index 75d27f2fa..5269ab619 100644 --- a/sdk/base-sys/src/bindings/storage.rs +++ b/sdk/base-sys/src/bindings/storage.rs @@ -3,7 +3,7 @@ use miden_stdlib_sys::{Felt, Word}; use super::StorageCommitmentRoot; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::active_account::get_item"] pub fn extern_get_storage_item(index: Felt, ptr: *mut Word); diff --git a/sdk/base-sys/src/bindings/tx.rs b/sdk/base-sys/src/bindings/tx.rs index b74fac9ae..153d84c68 100644 --- a/sdk/base-sys/src/bindings/tx.rs +++ b/sdk/base-sys/src/bindings/tx.rs @@ -1,7 +1,7 @@ use miden_stdlib_sys::{Felt, Word}; #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { #[link_name = "miden::tx::get_block_number"] pub fn extern_tx_get_block_number() -> Felt; diff --git a/sdk/base-sys/stubs/active_account.rs b/sdk/base-sys/stubs/active_account.rs index ec911b37f..a1bd01157 100644 --- a/sdk/base-sys/stubs/active_account.rs +++ b/sdk/base-sys/stubs/active_account.rs @@ -1,51 +1,51 @@ use core::ffi::c_void; -#[export_name = "miden::active_account::get_id"] +#[unsafe(export_name = "miden::active_account::get_id")] pub extern "C" fn active_account_get_id_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_nonce"] +#[unsafe(export_name = "miden::active_account::get_nonce")] pub extern "C" fn active_account_get_nonce_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_initial_commitment"] +#[unsafe(export_name = "miden::active_account::get_initial_commitment")] pub extern "C" fn active_account_get_initial_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::compute_commitment"] +#[unsafe(export_name = "miden::active_account::compute_commitment")] pub extern "C" fn active_account_compute_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_code_commitment"] +#[unsafe(export_name = "miden::active_account::get_code_commitment")] pub extern "C" fn active_account_get_code_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_initial_storage_commitment"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::active_account::compute_storage_commitment"] +#[unsafe(export_name = "miden::active_account::compute_storage_commitment")] pub extern "C" fn active_account_compute_storage_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_item"] +#[unsafe(export_name = "miden::active_account::get_item")] pub extern "C" fn active_account_get_item_plain(_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_initial_item"] +#[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 { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_map_item"] +#[unsafe(export_name = "miden::active_account::get_map_item")] pub extern "C" fn active_account_get_map_item_plain( _index: f32, _k0: f32, @@ -57,7 +57,7 @@ pub extern "C" fn active_account_get_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_initial_map_item"] +#[unsafe(export_name = "miden::active_account::get_initial_map_item")] pub extern "C" fn active_account_get_initial_map_item_plain( _index: f32, _k0: f32, @@ -69,17 +69,17 @@ pub extern "C" fn active_account_get_initial_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_balance"] +#[unsafe(export_name = "miden::active_account::get_balance")] pub extern "C" fn active_account_get_balance_plain(_prefix: f32, _suffix: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_initial_balance"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::active_account::has_non_fungible_asset"] +#[unsafe(export_name = "miden::active_account::has_non_fungible_asset")] pub extern "C" fn active_account_has_non_fungible_asset_plain( _a0: f32, _a1: f32, @@ -89,27 +89,27 @@ pub extern "C" fn active_account_has_non_fungible_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_initial_vault_root"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::active_account::get_vault_root"] +#[unsafe(export_name = "miden::active_account::get_vault_root")] pub extern "C" fn active_account_get_vault_root_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_num_procedures"] +#[unsafe(export_name = "miden::active_account::get_num_procedures")] pub extern "C" fn active_account_get_num_procedures_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_account::get_procedure_root"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::active_account::has_procedure"] +#[unsafe(export_name = "miden::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 fc3bc0b13..87ca01732 100644 --- a/sdk/base-sys/stubs/active_note.rs +++ b/sdk/base-sys/stubs/active_note.rs @@ -1,42 +1,42 @@ use core::ffi::c_void; /// Note interface stubs -#[export_name = "miden::active_note::get_inputs"] +#[unsafe(export_name = "miden::active_note::get_inputs")] pub extern "C" fn note_get_inputs_plain(_ptr: *mut c_void) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_note::get_assets"] +#[unsafe(export_name = "miden::active_note::get_assets")] pub extern "C" fn note_get_assets_plain(_ptr: *mut c_void) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_note::get_sender"] +#[unsafe(export_name = "miden::active_note::get_sender")] pub extern "C" fn note_get_sender_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_note::get_recipient"] +#[unsafe(export_name = "miden::active_note::get_recipient")] pub extern "C" fn note_get_recipient_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_note::get_script_root"] +#[unsafe(export_name = "miden::active_note::get_script_root")] pub extern "C" fn note_get_script_root_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_note::get_serial_number"] +#[unsafe(export_name = "miden::active_note::get_serial_number")] pub extern "C" fn note_get_serial_number_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_note::get_metadata"] +#[unsafe(export_name = "miden::active_note::get_metadata")] pub extern "C" fn note_get_metadata_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::active_note::add_assets_to_account"] +#[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 3abf1a7ea..ef9b03ad4 100644 --- a/sdk/base-sys/stubs/asset.rs +++ b/sdk/base-sys/stubs/asset.rs @@ -1,6 +1,6 @@ use core::ffi::c_void; -#[export_name = "miden::asset::build_fungible_asset"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::asset::build_non_fungible_asset"] +#[unsafe(export_name = "miden::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 309fb31cb..09514bffa 100644 --- a/sdk/base-sys/stubs/faucet.rs +++ b/sdk/base-sys/stubs/faucet.rs @@ -1,11 +1,11 @@ use core::ffi::c_void; -#[export_name = "miden::faucet::create_fungible_asset"] +#[unsafe(export_name = "miden::faucet::create_fungible_asset")] pub extern "C" fn faucet_create_fungible_asset_plain(_amount: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::faucet::create_non_fungible_asset"] +#[unsafe(export_name = "miden::faucet::create_non_fungible_asset")] pub extern "C" fn faucet_create_non_fungible_asset_plain( _h0: f32, _h1: f32, @@ -16,34 +16,22 @@ pub extern "C" fn faucet_create_non_fungible_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::faucet::mint"] -pub extern "C" fn faucet_mint_plain( - _a0: f32, - _a1: f32, - _a2: f32, - _a3: f32, - _out: *mut c_void, -) { +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::faucet::burn"] -pub extern "C" fn faucet_burn_plain( - _a0: f32, - _a1: f32, - _a2: f32, - _a3: f32, - _out: *mut c_void, -) { +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::faucet::get_total_issuance"] +#[unsafe(export_name = "miden::faucet::get_total_issuance")] pub extern "C" fn faucet_get_total_issuance_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::faucet::is_non_fungible_asset_issued"] +#[unsafe(export_name = "miden::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 af48cbb91..1aea9aae1 100644 --- a/sdk/base-sys/stubs/input_note.rs +++ b/sdk/base-sys/stubs/input_note.rs @@ -1,45 +1,42 @@ use core::ffi::c_void; /// Input note interface stubs -#[export_name = "miden::input_note::get_assets_info"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::input_note::get_assets"] -pub extern "C" fn input_note_get_assets_plain( - _dest_ptr: *mut c_void, - _note_index: f32, -) -> usize { +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::input_note::get_recipient"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::input_note::get_metadata"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::input_note::get_sender"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::input_note::get_inputs_info"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::input_note::get_script_root"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::input_note::get_serial_number"] +#[unsafe(export_name = "miden::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 7afd16574..99a8c27aa 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; -#[export_name = "miden::native_account::add_asset"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::native_account::remove_asset"] +#[unsafe(export_name = "miden::native_account::remove_asset")] pub extern "C" fn native_account_remove_asset_plain( _a0: f32, _a1: f32, @@ -22,17 +22,17 @@ pub extern "C" fn native_account_remove_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::native_account::incr_nonce"] +#[unsafe(export_name = "miden::native_account::incr_nonce")] pub extern "C" fn native_account_incr_nonce_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::native_account::compute_delta_commitment"] +#[unsafe(export_name = "miden::native_account::compute_delta_commitment")] pub extern "C" fn native_account_compute_delta_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::native_account::set_item"] +#[unsafe(export_name = "miden::native_account::set_item")] pub extern "C" fn native_account_set_item_plain( _index: f32, _v0: f32, @@ -44,7 +44,7 @@ pub extern "C" fn native_account_set_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::native_account::set_map_item"] +#[unsafe(export_name = "miden::native_account::set_map_item")] pub extern "C" fn native_account_set_map_item_plain( _index: f32, _k0: f32, @@ -60,7 +60,7 @@ pub extern "C" fn native_account_set_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::native_account::was_procedure_called"] +#[unsafe(export_name = "miden::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 d2a354619..6a502ea94 100644 --- a/sdk/base-sys/stubs/output_note.rs +++ b/sdk/base-sys/stubs/output_note.rs @@ -1,7 +1,7 @@ use core::ffi::c_void; /// Output note interface stubs -#[export_name = "miden::output_note::create"] +#[unsafe(export_name = "miden::output_note::create")] pub extern "C" fn output_note_create_plain( _tag: f32, _aux: f32, @@ -15,7 +15,7 @@ pub extern "C" fn output_note_create_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::output_note::add_asset"] +#[unsafe(export_name = "miden::output_note::add_asset")] pub extern "C" fn output_note_add_asset_plain( _a0: f32, _a1: f32, @@ -26,25 +26,22 @@ pub extern "C" fn output_note_add_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::output_note::get_assets_info"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::output_note::get_assets"] -pub extern "C" fn output_note_get_assets_plain( - _dest_ptr: *mut c_void, - _note_index: f32, -) -> usize { +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::output_note::get_recipient"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::output_note::get_metadata"] +#[unsafe(export_name = "miden::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() } } diff --git a/sdk/base-sys/stubs/tx.rs b/sdk/base-sys/stubs/tx.rs index 4d64c3056..1112865c0 100644 --- a/sdk/base-sys/stubs/tx.rs +++ b/sdk/base-sys/stubs/tx.rs @@ -1,46 +1,46 @@ use core::ffi::c_void; -#[export_name = "miden::tx::get_block_number"] +#[unsafe(export_name = "miden::tx::get_block_number")] pub extern "C" fn tx_get_block_number_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::tx::get_block_commitment"] +#[unsafe(export_name = "miden::tx::get_block_commitment")] pub extern "C" fn tx_get_block_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::tx::get_block_timestamp"] +#[unsafe(export_name = "miden::tx::get_block_timestamp")] pub extern "C" fn tx_get_block_timestamp_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::tx::get_input_notes_commitment"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::tx::get_output_notes_commitment"] +#[unsafe(export_name = "miden::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() } } -#[export_name = "miden::tx::get_num_input_notes"] +#[unsafe(export_name = "miden::tx::get_num_input_notes")] pub extern "C" fn tx_get_num_input_notes_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::tx::get_num_output_notes"] +#[unsafe(export_name = "miden::tx::get_num_output_notes")] pub extern "C" fn tx_get_num_output_notes_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::tx::get_expiration_block_delta"] +#[unsafe(export_name = "miden::tx::get_expiration_block_delta")] pub extern "C" fn tx_get_expiration_block_delta_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::tx::update_expiration_block_delta"] +#[unsafe(export_name = "miden::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/stdlib-sys/build.rs b/sdk/stdlib-sys/build.rs index 603bff469..33a79fee1 100644 --- a/sdk/stdlib-sys/build.rs +++ b/sdk/stdlib-sys/build.rs @@ -84,7 +84,7 @@ fn main() { let status = Command::new("rustc") .arg("--crate-name") .arg("miden_stdlib_sys_intrinsics_stubs") - .arg("--edition=2021") + .arg("--edition=2024") .arg("--crate-type=rlib") .arg("--target") .arg(&target) @@ -111,7 +111,7 @@ fn main() { let status = Command::new("rustc") .arg("--crate-name") .arg("miden_stdlib_sys_stdlib_stubs") - .arg("--edition=2021") + .arg("--edition=2024") .arg("--crate-type=rlib") .arg("--target") .arg(&target) diff --git a/sdk/stdlib-sys/src/intrinsics/advice.rs b/sdk/stdlib-sys/src/intrinsics/advice.rs index 0426c50e6..d7af65bec 100644 --- a/sdk/stdlib-sys/src/intrinsics/advice.rs +++ b/sdk/stdlib-sys/src/intrinsics/advice.rs @@ -2,7 +2,7 @@ use crate::{Felt, Word}; -extern "C" { +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. /// Returns the number of elements pushed on the advice stack. @@ -18,7 +18,7 @@ pub fn adv_push_mapvaln(key: Word) -> Felt { unsafe { extern_adv_push_mapvaln(key[3], key[2], key[1], key[0]) } } -extern "C" { +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`. #[link_name = "intrinsics::advice::emit_falcon_sig_to_stack"] @@ -46,7 +46,7 @@ pub fn emit_falcon_sig_to_stack(msg: Word, pub_key: Word) { } } -extern "C" { +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 /// Signature: (key0..key3, start_addr, end_addr) diff --git a/sdk/stdlib-sys/src/intrinsics/crypto.rs b/sdk/stdlib-sys/src/intrinsics/crypto.rs index f56b30eb6..341f9e80c 100644 --- a/sdk/stdlib-sys/src/intrinsics/crypto.rs +++ b/sdk/stdlib-sys/src/intrinsics/crypto.rs @@ -61,7 +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. -extern "C" { +unsafe extern "C" { /// Computes the hash of two digests using the Rescue Prime Optimized (RPO) /// permutation in 2-to-1 mode. /// diff --git a/sdk/stdlib-sys/src/intrinsics/debug.rs b/sdk/stdlib-sys/src/intrinsics/debug.rs index f96c2d590..6e6978f7c 100644 --- a/sdk/stdlib-sys/src/intrinsics/debug.rs +++ b/sdk/stdlib-sys/src/intrinsics/debug.rs @@ -1,4 +1,4 @@ -extern "C" { +unsafe extern "C" { #[link_name = "intrinsics::debug::break"] fn extern_break(); } diff --git a/sdk/stdlib-sys/src/intrinsics/felt.rs b/sdk/stdlib-sys/src/intrinsics/felt.rs index c1c2477b4..adb38bee7 100644 --- a/sdk/stdlib-sys/src/intrinsics/felt.rs +++ b/sdk/stdlib-sys/src/intrinsics/felt.rs @@ -1,6 +1,6 @@ use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; -extern "C" { +unsafe extern "C" { #[link_name = "intrinsics::felt::from_u64_unchecked"] fn extern_from_u64_unchecked(value: u64) -> Felt; diff --git a/sdk/stdlib-sys/src/stdlib/collections/smt.rs b/sdk/stdlib-sys/src/stdlib/collections/smt.rs index 72982b0af..b981f0bc8 100644 --- a/sdk/stdlib-sys/src/stdlib/collections/smt.rs +++ b/sdk/stdlib-sys/src/stdlib/collections/smt.rs @@ -18,7 +18,7 @@ pub struct SmtSetResponse { } #[allow(improper_ctypes)] -extern "C" { +unsafe extern "C" { /// Returns the value located under the specified `key` in the sparse Merkle tree defined by /// the specified `root`. /// diff --git a/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs b/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs index dd9321fc3..289590e0d 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs @@ -1,6 +1,6 @@ use crate::intrinsics::{Felt, Word}; -extern "C" { +unsafe extern "C" { #[link_name = "std::crypto::dsa::rpo_falcon512::verify"] fn extern_rpo_falcon512_verify( pk1: Felt, diff --git a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs index 367a8791c..ac8c36fe1 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs @@ -6,10 +6,10 @@ use alloc::vec::Vec; use crate::{ felt, - intrinsics::{assert_eq, Digest, Felt, Word}, + intrinsics::{Digest, Felt, Word, assert_eq}, }; -extern "C" { +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). @@ -55,7 +55,7 @@ extern "C" { ); } -extern "C" { +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). @@ -101,7 +101,7 @@ extern "C" { ); } -extern "C" { +unsafe extern "C" { /// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) /// hash function. /// diff --git a/sdk/stdlib-sys/src/stdlib/mem.rs b/sdk/stdlib-sys/src/stdlib/mem.rs index 73062026a..a6d47bff0 100644 --- a/sdk/stdlib-sys/src/stdlib/mem.rs +++ b/sdk/stdlib-sys/src/stdlib/mem.rs @@ -8,7 +8,7 @@ use crate::{ intrinsics::{Felt, Word}, }; -extern "C" { +unsafe extern "C" { /// Moves an arbitrary number of words from the advice stack to memory. /// diff --git a/sdk/stdlib-sys/stubs/collections.rs b/sdk/stdlib-sys/stubs/collections.rs index a41ca0420..eb19580ec 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 -#[export_name = "std::collections::smt::get"] +#[unsafe(export_name = "std::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() } } -#[export_name = "std::collections::smt::set"] +#[unsafe(export_name = "std::collections::smt::set")] pub extern "C" fn std_collections_smt_set_stub( v0: f32, v1: f32, @@ -34,8 +34,6 @@ pub extern "C" fn std_collections_smt_set_stub( r3: f32, result_ptr: *mut c_void, ) { - let _ = ( - v0, v1, v2, v3, k0, k1, k2, k3, r0, r1, r2, r3, result_ptr, - ); + let _ = (v0, v1, v2, v3, k0, k1, k2, k3, r0, r1, r2, r3, result_ptr); unsafe { core::hint::unreachable_unchecked() } } diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs b/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs index 09114c23a..d4255f2ec 100644 --- a/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs +++ b/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs @@ -2,7 +2,7 @@ use core::ffi::c_void; /// Unreachable stubs for std::crypto::hashes::blake3 -#[export_name = "std::crypto::hashes::blake3::hash_1to1"] +#[unsafe(export_name = "std::crypto::hashes::blake3::hash_1to1")] pub extern "C" fn blake3_hash_1to1_stub( e1: u32, e2: u32, @@ -18,7 +18,7 @@ pub extern "C" fn blake3_hash_1to1_stub( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "std::crypto::hashes::blake3::hash_2to1"] +#[unsafe(export_name = "std::crypto::hashes::blake3::hash_2to1")] pub extern "C" fn blake3_hash_2to1_stub( e1: u32, e2: u32, @@ -43,4 +43,3 @@ pub extern "C" fn blake3_hash_2to1_stub( ); unsafe { core::hint::unreachable_unchecked() } } - diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs b/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs index 3eaddd1ba..b39e67020 100644 --- a/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs +++ b/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs @@ -2,14 +2,14 @@ use core::ffi::c_void; /// Unreachable stub for std::crypto::hashes::rpo::hash_memory -#[export_name = "std::crypto::hashes::rpo::hash_memory"] +#[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) { let _ = (ptr, num_elements, result_ptr); unsafe { core::hint::unreachable_unchecked() } } /// Unreachable stub for std::crypto::hashes::rpo::hash_memory_words -#[export_name = "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, diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs b/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs index ede9ab358..c34ff1d23 100644 --- a/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs +++ b/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs @@ -2,7 +2,7 @@ use core::ffi::c_void; /// Unreachable stubs for std::crypto::hashes::sha256 -#[export_name = "std::crypto::hashes::sha256::hash_1to1"] +#[unsafe(export_name = "std::crypto::hashes::sha256::hash_1to1")] pub extern "C" fn sha256_hash_1to1_stub( e1: u32, e2: u32, @@ -18,7 +18,7 @@ pub extern "C" fn sha256_hash_1to1_stub( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "std::crypto::hashes::sha256::hash_2to1"] +#[unsafe(export_name = "std::crypto::hashes::sha256::hash_2to1")] pub extern "C" fn sha256_hash_2to1_stub( e1: u32, e2: u32, @@ -43,4 +43,3 @@ pub extern "C" fn sha256_hash_2to1_stub( ); unsafe { core::hint::unreachable_unchecked() } } - diff --git a/sdk/stdlib-sys/stubs/crypto/rpo_falcon_dsa.rs b/sdk/stdlib-sys/stubs/crypto/rpo_falcon_dsa.rs index 91afea78c..342ea6457 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. -#[export_name = "std::crypto::dsa::rpo_falcon512::verify"] +#[unsafe(export_name = "std::crypto::dsa::rpo_falcon512::verify")] pub extern "C" fn rpo_falcon512_verify_stub( _pk1: f32, _pk2: f32, diff --git a/sdk/stdlib-sys/stubs/intrinsics/advice.rs b/sdk/stdlib-sys/stubs/intrinsics/advice.rs index d4ab6f057..51cc8cff9 100644 --- a/sdk/stdlib-sys/stubs/intrinsics/advice.rs +++ b/sdk/stdlib-sys/stubs/intrinsics/advice.rs @@ -1,6 +1,6 @@ /// Unreachable stubs for intrinsics::advice interface -#[export_name = "intrinsics::advice::adv_push_mapvaln"] +#[unsafe(export_name = "intrinsics::advice::adv_push_mapvaln")] pub extern "C" fn advice_adv_push_mapvaln_stub( _key0: f32, _key1: f32, @@ -10,7 +10,7 @@ pub extern "C" fn advice_adv_push_mapvaln_stub( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::advice::emit_falcon_sig_to_stack"] +#[unsafe(export_name = "intrinsics::advice::emit_falcon_sig_to_stack")] pub extern "C" fn advice_emit_falcon_sig_to_stack_stub( _m0: f32, _m1: f32, @@ -24,7 +24,7 @@ pub extern "C" fn advice_emit_falcon_sig_to_stack_stub( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::advice::adv_insert_mem"] +#[unsafe(export_name = "intrinsics::advice::adv_insert_mem")] pub extern "C" fn advice_adv_insert_mem_stub( _k0: f32, _k1: f32, @@ -36,7 +36,7 @@ pub extern "C" fn advice_adv_insert_mem_stub( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::advice::emit_and_verify_falcon"] +#[unsafe(export_name = "intrinsics::advice::emit_and_verify_falcon")] pub extern "C" fn advice_emit_and_verify_falcon_stub( _m0: f32, _m1: f32, diff --git a/sdk/stdlib-sys/stubs/intrinsics/crypto.rs b/sdk/stdlib-sys/stubs/intrinsics/crypto.rs index 6e2d2e7b7..28abc6c45 100644 --- a/sdk/stdlib-sys/stubs/intrinsics/crypto.rs +++ b/sdk/stdlib-sys/stubs/intrinsics/crypto.rs @@ -2,8 +2,7 @@ use core::ffi::c_void; /// Unreachable stub for intrinsics::crypto::hmerge. /// Signature in Wasm is (i32 digests_ptr, i32 result_ptr) -#[export_name = "intrinsics::crypto::hmerge"] +#[unsafe(export_name = "intrinsics::crypto::hmerge")] pub extern "C" fn hmerge_stub(_digests_ptr: *const c_void, _result_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } - diff --git a/sdk/stdlib-sys/stubs/intrinsics/debug.rs b/sdk/stdlib-sys/stubs/intrinsics/debug.rs index 9767cb15e..864cab8db 100644 --- a/sdk/stdlib-sys/stubs/intrinsics/debug.rs +++ b/sdk/stdlib-sys/stubs/intrinsics/debug.rs @@ -1,7 +1,6 @@ /// Unreachable stubs for intrinsics::debug interface -#[export_name = "intrinsics::debug::break"] +#[unsafe(export_name = "intrinsics::debug::break")] pub extern "C" fn debug_break_stub() { unsafe { core::hint::unreachable_unchecked() } } - diff --git a/sdk/stdlib-sys/stubs/intrinsics/felt.rs b/sdk/stdlib-sys/stubs/intrinsics/felt.rs index b6c18c060..0e8dfd9ef 100644 --- a/sdk/stdlib-sys/stubs/intrinsics/felt.rs +++ b/sdk/stdlib-sys/stubs/intrinsics/felt.rs @@ -2,103 +2,102 @@ /// These are linked by name, and the frontend lowers calls /// to MASM operations or functions accordingly. -#[export_name = "intrinsics::felt::add"] +#[unsafe(export_name = "intrinsics::felt::add")] pub extern "C" fn felt_add_stub(_a: f32, _b: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::from_u64_unchecked"] +#[unsafe(export_name = "intrinsics::felt::from_u64_unchecked")] pub extern "C" fn felt_from_u64_unchecked_stub(_v: u64) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::from_u32"] +#[unsafe(export_name = "intrinsics::felt::from_u32")] pub extern "C" fn felt_from_u32_stub(_v: u32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::as_u64"] +#[unsafe(export_name = "intrinsics::felt::as_u64")] pub extern "C" fn felt_as_u64_stub(_a: f32) -> u64 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::sub"] +#[unsafe(export_name = "intrinsics::felt::sub")] pub extern "C" fn felt_sub_stub(_a: f32, _b: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::mul"] +#[unsafe(export_name = "intrinsics::felt::mul")] pub fn felt_mul_stub(_a: f32, _b: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::div"] +#[unsafe(export_name = "intrinsics::felt::div")] pub extern "C" fn felt_div_stub(_a: f32, _b: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::neg"] +#[unsafe(export_name = "intrinsics::felt::neg")] pub extern "C" fn felt_neg_stub(_a: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::inv"] +#[unsafe(export_name = "intrinsics::felt::inv")] pub extern "C" fn felt_inv_stub(_a: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::pow2"] +#[unsafe(export_name = "intrinsics::felt::pow2")] pub extern "C" fn felt_pow2_stub(_a: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::exp"] +#[unsafe(export_name = "intrinsics::felt::exp")] pub extern "C" fn felt_exp_stub(_a: f32, _b: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::eq"] +#[unsafe(export_name = "intrinsics::felt::eq")] pub extern "C" fn felt_eq_stub(_a: f32, _b: f32) -> i32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::gt"] +#[unsafe(export_name = "intrinsics::felt::gt")] pub extern "C" fn felt_gt_stub(_a: f32, _b: f32) -> i32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::lt"] +#[unsafe(export_name = "intrinsics::felt::lt")] pub extern "C" fn felt_lt_stub(_a: f32, _b: f32) -> i32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::ge"] +#[unsafe(export_name = "intrinsics::felt::ge")] pub extern "C" fn felt_ge_stub(_a: f32, _b: f32) -> i32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::le"] +#[unsafe(export_name = "intrinsics::felt::le")] pub extern "C" fn felt_le_stub(_a: f32, _b: f32) -> i32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::is_odd"] +#[unsafe(export_name = "intrinsics::felt::is_odd")] pub extern "C" fn felt_is_odd_stub(_a: f32) -> i32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::assert"] +#[unsafe(export_name = "intrinsics::felt::assert")] pub extern "C" fn felt_assert_stub(_a: f32) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::assertz"] +#[unsafe(export_name = "intrinsics::felt::assertz")] pub extern "C" fn felt_assertz_stub(_a: f32) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "intrinsics::felt::assert_eq"] +#[unsafe(export_name = "intrinsics::felt::assert_eq")] pub extern "C" fn felt_assert_eq_stub(_a: f32, _b: f32) { unsafe { core::hint::unreachable_unchecked() } } - diff --git a/sdk/stdlib-sys/stubs/mem.rs b/sdk/stdlib-sys/stubs/mem.rs index aec9fc0c1..1b9498775 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 -#[export_name = "std::mem::pipe_words_to_memory"] +#[unsafe(export_name = "std::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() } } -#[export_name = "std::mem::pipe_double_words_to_memory"] +#[unsafe(export_name = "std::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() } } -#[export_name = "std::mem::pipe_preimage_to_memory"] +#[unsafe(export_name = "std::mem::pipe_preimage_to_memory")] pub extern "C" fn std_mem_pipe_preimage_to_memory_stub( _num_words: f32, _write_ptr: *mut c_void, @@ -43,4 +43,3 @@ pub extern "C" fn std_mem_pipe_preimage_to_memory_stub( ) -> i32 { unsafe { core::hint::unreachable_unchecked() } } - diff --git a/tests/integration-node/src/local_node/setup.rs b/tests/integration-node/src/local_node/setup.rs index 5e3d32286..1e49339e1 100644 --- a/tests/integration-node/src/local_node/setup.rs +++ b/tests/integration-node/src/local_node/setup.rs @@ -2,9 +2,9 @@ use std::{fs, path::Path, process::Command}; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; -use super::{process::kill_process, sync::read_pid, COORD_DIR}; +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 @@ -61,10 +61,10 @@ impl LocalMidenNode { } // Clean the entire coordination directory - if let Err(e) = fs::remove_dir_all(COORD_DIR) { - if e.kind() != std::io::ErrorKind::NotFound { - eprintln!("Warning: Failed to clean coordination directory: {e}"); - } + 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 diff --git a/tests/integration-node/src/local_node/sync.rs b/tests/integration-node/src/local_node/sync.rs index ddc2076bb..8a41549fa 100644 --- a/tests/integration-node/src/local_node/sync.rs +++ b/tests/integration-node/src/local_node/sync.rs @@ -6,13 +6,13 @@ use std::{ time::Duration, }; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use fs2::FileExt; use super::{ - lock_file, pid_file, + COORD_DIR, lock_file, pid_file, process::{is_process_running, kill_process}, - ref_count_dir, COORD_DIR, + ref_count_dir, }; /// Lock guard using fs2 file locking @@ -94,15 +94,15 @@ pub fn get_ref_count() -> Result { 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) { - if 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()); - } + 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()); } } } diff --git a/tests/integration/src/cargo_proj/mod.rs b/tests/integration/src/cargo_proj/mod.rs index 29ad586a7..cf68b9166 100644 --- a/tests/integration/src/cargo_proj/mod.rs +++ b/tests/integration/src/cargo_proj/mod.rs @@ -12,7 +12,7 @@ use std::{ time::{self, Duration}, }; -use cargo_util::{is_ci, ProcessBuilder}; +use cargo_util::{ProcessBuilder, is_ci}; /// Panics with a formatted message if the expression does not return `Ok`. #[macro_export] @@ -396,7 +396,7 @@ pub fn basic_manifest(name: &str, version: &str) -> String { name = "{name}" version = "{version}" authors = [] - edition = "2021" + edition = "2024" "# ) } @@ -409,7 +409,7 @@ pub fn basic_bin_manifest(name: &str) -> String { name = "{name}" version = "0.5.0" authors = ["wycats@example.com"] - edition = "2021" + edition = "2024" [[bin]] @@ -426,7 +426,7 @@ pub fn basic_lib_manifest(name: &str) -> String { name = "{name}" version = "0.5.0" authors = ["wycats@example.com"] - edition = "2021" + edition = "2024" [lib] diff --git a/tests/integration/src/compiler_test.rs b/tests/integration/src/compiler_test.rs index 41ee9786f..eb1be3674 100644 --- a/tests/integration/src/compiler_test.rs +++ b/tests/integration/src/compiler_test.rs @@ -15,7 +15,7 @@ use midenc_compile::{ }; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::{ - demangle::demangle, dialects::builtin, interner::Symbol, Context, FunctionIdent, Ident, Op, + Context, FunctionIdent, Ident, Op, demangle::demangle, dialects::builtin, interner::Symbol, }; use midenc_session::{InputFile, InputType, Session}; @@ -277,12 +277,8 @@ impl CompilerTestBuilder { /// Override the Cargo target directory to the specified path pub fn with_target_dir(&mut self, path: impl AsRef) -> &mut Self { match &mut self.source { - CompilerTestInputType::CargoMiden(CargoTest { - ref mut target_dir, .. - }) - | CompilerTestInputType::Rustc(RustcTest { - ref mut target_dir, .. - }) => { + CompilerTestInputType::CargoMiden(CargoTest { target_dir, .. }) + | CompilerTestInputType::Rustc(RustcTest { target_dir, .. }) => { *target_dir = Some(path.as_ref().to_path_buf()); } } @@ -559,7 +555,7 @@ impl CompilerTestBuilder { [package] name = "{name}" version = "0.0.1" - edition = "2021" + edition = "2024" authors = [] [dependencies] @@ -640,7 +636,7 @@ impl CompilerTestBuilder { [package] name = "{name}" version = "0.0.1" - edition = "2021" + edition = "2024" authors = [] [dependencies] @@ -706,7 +702,7 @@ use alloc::vec::Vec; config: WasmTranslationConfig, midenc_flags: impl IntoIterator, ) -> Self { - let source = format!("#[no_mangle]\npub extern \"C\" fn entrypoint{source}"); + let source = format!("#[unsafe(no_mangle)]\npub extern \"C\" fn entrypoint{source}"); Self::rust_source_with_sdk(name, &source, config, midenc_flags) } } @@ -886,10 +882,10 @@ impl CompilerTest { /// Get the MASM source code pub fn masm_src(&mut self) -> String { - if self.masm_src.is_none() { - if let Err(err) = self.compile_wasm_to_masm_program() { - panic!("{err}"); - } + if self.masm_src.is_none() + && let Err(err) = self.compile_wasm_to_masm_program() + { + panic!("{err}"); } self.masm_src.clone().unwrap() } diff --git a/tests/integration/src/rust_masm_tests/apps.rs b/tests/integration/src/rust_masm_tests/apps.rs index e629b0911..93e55bcac 100644 --- a/tests/integration/src/rust_masm_tests/apps.rs +++ b/tests/integration/src/rust_masm_tests/apps.rs @@ -7,9 +7,9 @@ use midenc_hir::Felt; use proptest::{prelude::*, test_runner::TestRunner}; use crate::{ + CompilerTest, CompilerTestBuilder, cargo_proj::project, compiler_test::{sdk_alloc_crate_path, sdk_crate_path}, - CompilerTest, CompilerTestBuilder, }; fn cargo_toml(name: &str) -> String { @@ -20,7 +20,7 @@ fn cargo_toml(name: &str) -> String { [package] name = "{name}" version = "0.0.1" - edition = "2021" + edition = "2024" authors = [] [lib] @@ -76,13 +76,13 @@ fn function_call_hir2() { // use miden::Felt; - #[no_mangle] + #[unsafe(no_mangle)] #[inline(never)] pub fn add(a: u32, b: u32) -> u32 { a + b } - #[no_mangle] + #[unsafe(no_mangle)] pub fn entrypoint(a: u32, b: u32) -> u32 { add(a, b) } @@ -131,7 +131,7 @@ fn mem_intrinsics_heap_base() { extern crate alloc; use alloc::{vec, vec::Vec}; - #[no_mangle] + #[unsafe(no_mangle)] pub fn entrypoint(a: u32) -> Vec { vec![a*2] } @@ -179,7 +179,7 @@ fn felt_intrinsics() { use miden::*; - #[no_mangle] + #[unsafe(no_mangle)] pub fn entrypoint(a: Felt, b: Felt) -> Felt { a / (a * b - a + b) } diff --git a/tests/integration/src/rust_masm_tests/misc.rs b/tests/integration/src/rust_masm_tests/misc.rs index daece0a98..961fc0960 100644 --- a/tests/integration/src/rust_masm_tests/misc.rs +++ b/tests/integration/src/rust_masm_tests/misc.rs @@ -3,8 +3,8 @@ use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use crate::{ - testing::{eval_package, setup}, CompilerTest, + testing::{eval_package, setup}, }; #[test] @@ -15,7 +15,7 @@ fn test_func_arg_same() { intrinsic(x, y) } - #[no_mangle] + #[unsafe(no_mangle)] #[inline(never)] fn intrinsic(a: &mut Felt, b: &mut Felt) -> i32 { unsafe { (a as *mut Felt) as i32 } @@ -92,7 +92,7 @@ fn test_func_arg_order() { }} }} - #[no_mangle] + #[unsafe(no_mangle)] fn intrinsic(digests_ptr: *const Felt, result_ptr: *mut Felt) {{ // see assert_eq above, before the call assert_eq(Felt::from_u32(digests_ptr as u32), Felt::from_u32(1048528)); 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 c8f132881..550b1c4c4 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 @@ -26,7 +26,7 @@ impl TestAccount {{ [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs index e29998157..ae862303c 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs @@ -26,7 +26,7 @@ impl TestAsset {{ [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs index 79a23744a..50c87fcee 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs @@ -26,7 +26,7 @@ impl TestFaucet {{ [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] 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 71d17e220..54f2aa17f 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 @@ -28,7 +28,7 @@ cargo-features = ["trim-paths"] [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] 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 index 41d0fb271..88422a767 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs @@ -24,7 +24,7 @@ fn run(_arg: Word) {{ [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] 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 1a3a0afe3..3df3ef1b2 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 @@ -28,7 +28,7 @@ cargo-features = ["trim-paths"] [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs index 4a9e9df09..d81b4db0e 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs @@ -24,7 +24,7 @@ fn run(_arg: Word) {{ [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] 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 5f92c14db..d46df91e9 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -1,8 +1,8 @@ use std::{collections::BTreeMap, env, path::PathBuf, sync::Arc}; use miden_core::{ - utils::{Deserializable, Serializable}, Felt, FieldElement, Word, + utils::{Deserializable, Serializable}, }; use miden_debug::Executor; use miden_lib::MidenLib; @@ -10,13 +10,13 @@ use miden_mast_package::Package; use miden_objects::account::{AccountComponentMetadata, AccountComponentTemplate, InitStorageData}; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; -use midenc_hir::{interner::Symbol, FunctionIdent, Ident, SourceSpan}; +use midenc_hir::{FunctionIdent, Ident, SourceSpan, interner::Symbol}; use midenc_session::STDLIB; use crate::{ + CompilerTest, CompilerTestBuilder, cargo_proj::project, compiler_test::{sdk_alloc_crate_path, sdk_crate_path}, - CompilerTest, CompilerTestBuilder, }; mod base; @@ -66,7 +66,7 @@ fn rust_sdk_swapp_note_bindings() { [package] name = "{name}" version = "0.0.1" -edition = "2021" +edition = "2024" authors = [] [lib] diff --git a/tests/integration/src/rust_masm_tests/types_src/array.rs b/tests/integration/src/rust_masm_tests/types_src/array.rs index 8dab20c15..ff87a0744 100644 --- a/tests/integration/src/rust_masm_tests/types_src/array.rs +++ b/tests/integration/src/rust_masm_tests/types_src/array.rs @@ -7,12 +7,12 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { } #[inline(never)] -#[no_mangle] +#[unsafe(no_mangle)] pub fn sum_arr(arr: &[u32]) -> u32 { arr.iter().sum() } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn __main() -> u32 { sum_arr(&[1, 2, 3, 4, 5]) + sum_arr(&[6, 7, 8, 9, 10]) } diff --git a/tests/integration/src/rust_masm_tests/types_src/enum.rs b/tests/integration/src/rust_masm_tests/types_src/enum.rs index 566f493fa..bb46508af 100644 --- a/tests/integration/src/rust_masm_tests/types_src/enum.rs +++ b/tests/integration/src/rust_masm_tests/types_src/enum.rs @@ -13,7 +13,7 @@ enum Op { } #[inline(never)] -#[no_mangle] +#[unsafe(no_mangle)] fn match_enum(a: u32, b: u32, foo: Op) -> u32 { match foo { Op::Add => a + b, @@ -22,7 +22,7 @@ fn match_enum(a: u32, b: u32, foo: Op) -> u32 { } } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn __main() -> u32 { match_enum(3, 5, Op::Add) + match_enum(3, 5, Op::Sub) + match_enum(3, 5, Op::Mul) } diff --git a/tests/integration/src/rust_masm_tests/types_src/static_mut.rs b/tests/integration/src/rust_masm_tests/types_src/static_mut.rs index 2d82148f2..f01971945 100644 --- a/tests/integration/src/rust_masm_tests/types_src/static_mut.rs +++ b/tests/integration/src/rust_masm_tests/types_src/static_mut.rs @@ -9,14 +9,14 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { static mut G1: [u8; 9] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; #[inline(never)] -#[no_mangle] +#[unsafe(no_mangle)] fn global_var_update() { unsafe { G1[0] = G1[1] + 1; } } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn __main() -> u32 { global_var_update(); unsafe { G1.into_iter().sum::() as u32 } diff --git a/tests/lit/source-location/test-project/Cargo.toml b/tests/lit/source-location/test-project/Cargo.toml index 9cfb3d179..9abe2f178 100644 --- a/tests/lit/source-location/test-project/Cargo.toml +++ b/tests/lit/source-location/test-project/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "source_location_test" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] crate-type = ["cdylib"] diff --git a/tests/lit/source-location/test-project/src/lib.rs b/tests/lit/source-location/test-project/src/lib.rs index 4ee59256c..35082cd10 100644 --- a/tests/lit/source-location/test-project/src/lib.rs +++ b/tests/lit/source-location/test-project/src/lib.rs @@ -6,14 +6,14 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { core::arch::wasm32::unreachable() } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn test_assertion(x: u32) -> u32 { assert!(x > 100, "x should be greater than 100"); x } -#[no_mangle] +#[unsafe(no_mangle)] #[inline(never)] pub fn entrypoint(x: u32) -> u32 { test_assertion(x) diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml index eca3defde..9d6aa3113 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml @@ -4,7 +4,7 @@ cargo-features = ["trim-paths"] name = "miden-sdk-account-test" rust-version = "1.71" license = "MIT" -edition = "2021" +edition = "2024" [lib] crate-type = ["cdylib", "rlib"] 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 index 48e7b6696..2b0b5003b 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs @@ -11,21 +11,21 @@ static ALLOC: BumpAlloc = BumpAlloc::new(); pub struct Account; impl Account { - #[no_mangle] + #[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() } - #[no_mangle] + #[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] } - #[no_mangle] + #[unsafe(no_mangle)] pub fn test_felt_ops_smoke(a: Felt, b: Felt) -> Felt { let d = a.as_u64(); if a > b { @@ -54,7 +54,7 @@ impl Account { pub struct Note; impl Note { - #[no_mangle] + #[unsafe(no_mangle)] pub fn note_script() -> Felt { let mut sum = Felt::new(0).unwrap(); for input in miden::active_note::get_inputs() { @@ -64,38 +64,38 @@ impl Note { } } -#[no_mangle] +#[unsafe(no_mangle)] pub fn test_blake3_hash_1to1(input: [u8; 32]) -> [u8; 32] { blake3_hash_1to1(input) } -#[no_mangle] +#[unsafe(no_mangle)] pub fn test_blake3_hash_2to1(input: [u8; 64]) -> [u8; 32] { blake3_hash_2to1(input) } -#[no_mangle] +#[unsafe(no_mangle)] pub fn test_rpo_falcon512_verify(pk: Word, msg: Word) { rpo_falcon512_verify(pk, msg) } -#[no_mangle] +#[unsafe(no_mangle)] pub fn test_pipe_words_to_memory(num_words: Felt) -> (Word, Vec) { pipe_words_to_memory(num_words) } -#[no_mangle] +#[unsafe(no_mangle)] pub fn test_pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { pipe_double_words_to_memory(num_words) } -#[no_mangle] +#[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] } -#[no_mangle] +#[unsafe(no_mangle)] pub fn test_create_note( asset: Asset, tag: Tag, diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/add/Cargo.toml index 5c2bfc6d0..28c310228 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "pure-rust-add" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs index df43314f1..35b65b1d4 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/add/src/lib.rs @@ -20,7 +20,7 @@ fn my_alloc_error(_info: core::alloc::Layout) -> ! { // use miden::Felt; -#[no_mangle] +#[unsafe(no_mangle)] pub fn entrypoint(a: u32, b: u32) -> u32 { a + b } diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.toml index bf327b9b4..cbb990a7b 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "component_macros_account" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] crate-type = ["cdylib"] diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.toml index 646ba57c2..69218539f 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "component_macros_note" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] crate-type = ["cdylib"] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml index aca76a4d8..d108cc2cb 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "cross-ctx-account-word-arg" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml index 017af0df4..1ca2a5158 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "cross-ctx-account-word" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml index f396ed254..f548edc75 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "cross-ctx-account" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml index b711a284c..7b1df9daa 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "cross-ctx-note-word-arg" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml index ebd8e7483..49a356827 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "cross-ctx-note-word" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml index 3eadf0ee5..cd84676ca 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml @@ -3,7 +3,7 @@ cargo-features = ["trim-paths"] [package] name = "cross-ctx-note" version = "0.1.0" -edition = "2021" +edition = "2024" [lib] # Build this crate as a self-contained, C-style dynamic library diff --git a/tools/cargo-miden/src/commands/example_project.rs b/tools/cargo-miden/src/commands/example_project.rs index fed87993a..6914f4b21 100644 --- a/tools/cargo-miden/src/commands/example_project.rs +++ b/tools/cargo-miden/src/commands/example_project.rs @@ -5,7 +5,7 @@ use clap::Args; use toml_edit::{DocumentMut, Item}; use crate::{ - template::{generate, GenerateArgs, TemplatePath}, + template::{GenerateArgs, TemplatePath, generate}, utils::compiler_path, }; @@ -256,19 +256,19 @@ fn process_cargo_toml(project_path: &Path) -> anyhow::Result<()> { 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()) { - if 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 - })); - } + 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 @@ -299,14 +299,13 @@ fn update_project_dependency( .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) { - if 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 - })); - } + *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 @@ -321,19 +320,16 @@ fn update_project_dependency( .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") { - if let Some(wit_dep) = wit_deps.get_mut(dependency_name) { - if let Some(table) = wit_dep.as_inline_table_mut() { - if 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}")) - }; - } - } - } + 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())?; diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index a760e2a6a..cab73cf56 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -7,7 +7,7 @@ use anyhow::Context; use clap::Args; use toml_edit::{DocumentMut, Item, Value}; -use crate::template::{generate, GenerateArgs, TemplatePath}; +use crate::template::{GenerateArgs, TemplatePath, generate}; /// The tag used in checkout of the new project template. /// @@ -282,10 +282,10 @@ fn find_workspace_cargo_toml(start_path: &Path) -> Option { let cargo_toml = ancestor.join("Cargo.toml"); if cargo_toml.exists() { // Check if it's a workspace by reading and parsing it - if let Ok(content) = fs::read_to_string(&cargo_toml) { - if content.contains("[workspace]") { - return Some(cargo_toml); - } + if let Ok(content) = fs::read_to_string(&cargo_toml) + && content.contains("[workspace]") + { + return Some(cargo_toml); } } } diff --git a/tools/cargo-miden/tests/build.rs b/tools/cargo-miden/tests/build.rs index 35c523c38..1c9c10f42 100644 --- a/tools/cargo-miden/tests/build.rs +++ b/tools/cargo-miden/tests/build.rs @@ -1,6 +1,6 @@ use std::{env, fs}; -use cargo_miden::{run, OutputType}; +use cargo_miden::{OutputType, run}; use miden_mast_package::Package; use midenc_session::miden_assembly::utils::Deserializable; @@ -46,7 +46,7 @@ fn test_all_templates_and_examples() { // // This is necessary because cfg!(test) does not work for integration tests, so we're forced // to use an out-of-band signal like this instead - env::set_var("TEST", "1"); + unsafe { env::set_var("TEST", "1") }; // Test example templates @@ -444,7 +444,7 @@ fn new_project_integration_tests_pass() { .is_test(true) .format_timestamp(None) .try_init(); - env::set_var("TEST", "1"); + unsafe { env::set_var("TEST", "1") }; let restore_dir = env::current_dir().unwrap(); let temp_dir = env::temp_dir().join(format!( diff --git a/tools/cargo-miden/tests/workspace.rs b/tools/cargo-miden/tests/workspace.rs index 951bf185e..245d51045 100644 --- a/tools/cargo-miden/tests/workspace.rs +++ b/tools/cargo-miden/tests/workspace.rs @@ -1,6 +1,6 @@ use std::{env, fs, path::Path}; -use cargo_miden::{run, BuildOutput, OutputType}; +use cargo_miden::{BuildOutput, OutputType, run}; /// Creates a minimal Cargo workspace at `root` with a single member named `member_name`. fn write_workspace_root(root: &Path, member_name: &str) { @@ -11,7 +11,7 @@ members = ["{member_name}"] [workspace.package] version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Miden Contributors"] license = "MIT" repository = "https://example.com/test" @@ -27,7 +27,7 @@ resolver = "2" [workspace.package] version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Miden Contributors"] license = "MIT" repository = "https://example.com/test" @@ -45,7 +45,7 @@ members = [{members_str}] [workspace.package] version = "0.1.0" -edition = "2021" +edition = "2024" authors = ["Miden Contributors"] license = "MIT" repository = "https://example.com/test" @@ -74,7 +74,9 @@ fn build_workspace_member_account_project() { .format_timestamp(None) .try_init(); // signal integration tests to the cargo-miden code path - env::set_var("TEST", "1"); + unsafe { + env::set_var("TEST", "1"); + } // create temp workspace root let restore_dir = env::current_dir().unwrap(); @@ -125,7 +127,9 @@ fn build_from_workspace_root_is_rejected() { .is_test(true) .format_timestamp(None) .try_init(); - env::set_var("TEST", "1"); + unsafe { + env::set_var("TEST", "1"); + } // create temp workspace root let restore_dir = env::current_dir().unwrap(); @@ -175,7 +179,9 @@ fn new_project_auto_adds_to_workspace() { .is_test(true) .format_timestamp(None) .try_init(); - env::set_var("TEST", "1"); + unsafe { + env::set_var("TEST", "1"); + } // create temp workspace root let restore_dir = env::current_dir().unwrap(); @@ -231,7 +237,9 @@ fn new_project_auto_adds_to_workspace_with_existing_members() { .is_test(true) .format_timestamp(None) .try_init(); - env::set_var("TEST", "1"); + unsafe { + env::set_var("TEST", "1"); + } // create temp workspace root let restore_dir = env::current_dir().unwrap(); @@ -288,7 +296,9 @@ fn new_project_does_not_duplicate_existing_member() { .is_test(true) .format_timestamp(None) .try_init(); - env::set_var("TEST", "1"); + unsafe { + env::set_var("TEST", "1"); + } // create temp workspace root let restore_dir = env::current_dir().unwrap(); diff --git a/tools/expect-test/src/lib.rs b/tools/expect-test/src/lib.rs index 20a3bf8ea..aee623eb6 100644 --- a/tools/expect-test/src/lib.rs +++ b/tools/expect-test/src/lib.rs @@ -626,19 +626,18 @@ fn format_patch(desired_indent: Option, patch: &str) -> String { } let mut final_newline = false; for line in lines_with_ends(patch) { - if is_multiline && !line.trim().is_empty() { - if let Some(indent) = &indent { - buf.push_str(indent); - buf.push_str(" "); - } + if is_multiline + && !line.trim().is_empty() + && let Some(indent) = &indent + { + buf.push_str(indent); + buf.push_str(" "); } buf.push_str(line); final_newline = line.ends_with('\n'); } - if final_newline { - if let Some(indent) = &indent { - buf.push_str(indent); - } + if final_newline && let Some(indent) = &indent { + buf.push_str(indent); } lit_kind.write_end(&mut buf).unwrap(); if matches!(lit_kind, StrLitKind::Raw(_)) { From e73781a7df540c072b059f08e3a27cf979ed9f1c Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Sun, 14 Dec 2025 13:53:44 -0500 Subject: [PATCH 59/70] chore: update expect tests after toolchain modifications --- .../abi_transform_tx_kernel_get_id.hir | 210 +- .../abi_transform_tx_kernel_get_id.wat | 78 +- .../abi_transform_tx_kernel_get_inputs_4.hir | 1759 +++++++------ .../abi_transform_tx_kernel_get_inputs_4.masm | 1453 ++++++----- .../abi_transform_tx_kernel_get_inputs_4.wat | 389 ++- .../expected/adv_load_preimage.hir | 1307 +++++----- .../expected/adv_load_preimage.masm | 747 +++--- .../expected/adv_load_preimage.wat | 220 +- .../examples/auth_component_no_auth.hir | 14 +- .../examples/auth_component_no_auth.masm | 14 +- .../examples/auth_component_no_auth.wat | 46 +- .../examples/auth_component_rpo_falcon512.hir | 1530 +++++------ .../auth_component_rpo_falcon512.masm | 600 +++-- .../examples/auth_component_rpo_falcon512.wat | 242 +- .../expected/examples/basic_wallet.hir | 286 +-- .../expected/examples/basic_wallet.masm | 90 +- .../expected/examples/basic_wallet.wat | 152 +- .../examples/basic_wallet_tx_script.hir | 2255 +++++++++-------- .../examples/basic_wallet_tx_script.masm | 1714 +++++++------ .../examples/basic_wallet_tx_script.wat | 471 ++-- .../integration/expected/examples/counter.hir | 220 +- .../expected/examples/counter.masm | 44 +- .../integration/expected/examples/counter.wat | 68 +- .../expected/examples/counter_note.hir | 16 +- .../expected/examples/counter_note.masm | 8 +- .../expected/examples/counter_note.wat | 68 +- tests/integration/expected/examples/p2id.hir | 1641 ++++++------ tests/integration/expected/examples/p2id.masm | 1325 +++++----- tests/integration/expected/examples/p2id.wat | 360 ++- .../expected/examples/storage_example.hir | 860 +++---- .../expected/examples/storage_example.masm | 380 +-- .../expected/examples/storage_example.wat | 188 +- .../integration/expected/felt_intrinsics.hir | 158 +- .../integration/expected/felt_intrinsics.wat | 64 +- tests/integration/expected/hash_elements.hir | 214 +- tests/integration/expected/hash_elements.masm | 34 +- tests/integration/expected/hash_elements.wat | 30 +- tests/integration/expected/hash_words.hir | 190 +- tests/integration/expected/hash_words.masm | 34 +- tests/integration/expected/hash_words.wat | 28 +- .../expected/mem_intrinsics_heap_base.hir | 86 +- .../expected/mem_intrinsics_heap_base.wat | 24 +- .../rust_sdk/component_macros_account.wat | 66 +- .../rust_sdk/component_macros_note.hir | 16 +- .../rust_sdk/component_macros_note.masm | 8 +- .../rust_sdk/component_macros_note.wat | 94 +- .../expected/rust_sdk/cross_ctx_account.hir | 12 +- .../expected/rust_sdk/cross_ctx_account.masm | 8 +- .../expected/rust_sdk/cross_ctx_account.wat | 40 +- .../rust_sdk/cross_ctx_account_word.hir | 456 ++-- .../rust_sdk/cross_ctx_account_word.masm | 508 ++-- .../rust_sdk/cross_ctx_account_word.wat | 286 +-- .../rust_sdk/cross_ctx_account_word_arg.wat | 40 +- .../expected/rust_sdk/cross_ctx_note.hir | 22 +- .../expected/rust_sdk/cross_ctx_note.masm | 10 +- .../expected/rust_sdk/cross_ctx_note.wat | 66 +- .../expected/rust_sdk/cross_ctx_note_word.hir | 24 +- .../rust_sdk/cross_ctx_note_word.masm | 20 +- .../expected/rust_sdk/cross_ctx_note_word.wat | 166 +- .../rust_sdk/cross_ctx_note_word_arg.hir | 16 +- .../rust_sdk/cross_ctx_note_word_arg.masm | 8 +- .../rust_sdk/cross_ctx_note_word_arg.wat | 66 +- .../expected/rust_sdk/pure_rust_add.hir | 144 +- .../expected/rust_sdk/pure_rust_add.wat | 34 +- ...unt_asset_build_fungible_asset_binding.hir | 4 +- ...nt_asset_build_fungible_asset_binding.masm | 4 +- ...unt_asset_build_fungible_asset_binding.wat | 44 +- ...asset_build_non_fungible_asset_binding.hir | 4 +- ...sset_build_non_fungible_asset_binding.masm | 4 +- ...asset_build_non_fungible_asset_binding.wat | 44 +- ...sdk_account_compute_commitment_binding.hir | 4 +- ...dk_account_compute_commitment_binding.masm | 4 +- ...sdk_account_compute_commitment_binding.wat | 40 +- ...count_compute_delta_commitment_binding.hir | 4 +- ...ount_compute_delta_commitment_binding.masm | 4 +- ...count_compute_delta_commitment_binding.wat | 40 +- ...unt_compute_storage_commitment_binding.hir | 4 +- ...nt_compute_storage_commitment_binding.masm | 4 +- ...unt_compute_storage_commitment_binding.wat | 40 +- .../rust_sdk_account_faucet_burn_binding.hir | 4 +- .../rust_sdk_account_faucet_burn_binding.masm | 4 +- .../rust_sdk_account_faucet_burn_binding.wat | 44 +- ...t_faucet_create_fungible_asset_binding.hir | 4 +- ..._faucet_create_fungible_asset_binding.masm | 4 +- ...t_faucet_create_fungible_asset_binding.wat | 44 +- ...ucet_create_non_fungible_asset_binding.hir | 4 +- ...cet_create_non_fungible_asset_binding.masm | 4 +- ...ucet_create_non_fungible_asset_binding.wat | 44 +- ...ount_faucet_get_total_issuance_binding.wat | 32 +- ...t_is_non_fungible_asset_issued_binding.hir | 16 +- ..._is_non_fungible_asset_issued_binding.masm | 8 +- ...t_is_non_fungible_asset_issued_binding.wat | 40 +- .../rust_sdk_account_faucet_mint_binding.hir | 4 +- .../rust_sdk_account_faucet_mint_binding.masm | 4 +- .../rust_sdk_account_faucet_mint_binding.wat | 44 +- ...dk_account_get_code_commitment_binding.hir | 4 +- ...k_account_get_code_commitment_binding.masm | 4 +- ...dk_account_get_code_commitment_binding.wat | 40 +- ...dk_account_get_initial_balance_binding.wat | 32 +- ...get_initial_storage_commitment_binding.hir | 4 +- ...et_initial_storage_commitment_binding.masm | 4 +- ...get_initial_storage_commitment_binding.wat | 40 +- ...account_get_initial_vault_root_binding.hir | 4 +- ...ccount_get_initial_vault_root_binding.masm | 4 +- ...account_get_initial_vault_root_binding.wat | 40 +- ...sdk_account_get_num_procedures_binding.wat | 32 +- ...sdk_account_get_procedure_root_binding.hir | 198 +- ...dk_account_get_procedure_root_binding.masm | 20 +- ...sdk_account_get_procedure_root_binding.wat | 56 +- ...ust_sdk_account_get_vault_root_binding.hir | 4 +- ...st_sdk_account_get_vault_root_binding.masm | 4 +- ...ust_sdk_account_get_vault_root_binding.wat | 40 +- ...account_has_non_fungible_asset_binding.hir | 16 +- ...ccount_has_non_fungible_asset_binding.masm | 8 +- ...account_has_non_fungible_asset_binding.wat | 40 +- ...rust_sdk_account_has_procedure_binding.hir | 16 +- ...ust_sdk_account_has_procedure_binding.masm | 8 +- ...rust_sdk_account_has_procedure_binding.wat | 40 +- ...count_storage_get_initial_item_binding.hir | 198 +- ...ount_storage_get_initial_item_binding.masm | 20 +- ...count_storage_get_initial_item_binding.wat | 56 +- ...t_storage_get_initial_map_item_binding.hir | 198 +- ..._storage_get_initial_map_item_binding.masm | 20 +- ...t_storage_get_initial_map_item_binding.wat | 58 +- ...ccount_tx_get_block_commitment_binding.hir | 4 +- ...count_tx_get_block_commitment_binding.masm | 4 +- ...ccount_tx_get_block_commitment_binding.wat | 40 +- ...dk_account_tx_get_block_number_binding.wat | 36 +- ...account_tx_get_block_timestamp_binding.wat | 36 +- ..._tx_get_expiration_block_delta_binding.wat | 36 +- ..._tx_get_input_notes_commitment_binding.hir | 4 +- ...tx_get_input_notes_commitment_binding.masm | 4 +- ..._tx_get_input_notes_commitment_binding.wat | 40 +- ...account_tx_get_num_input_notes_binding.wat | 36 +- ...ccount_tx_get_num_output_notes_binding.wat | 36 +- ...tx_get_output_notes_commitment_binding.hir | 4 +- ...x_get_output_notes_commitment_binding.masm | 4 +- ...tx_get_output_notes_commitment_binding.wat | 40 +- ..._update_expiration_block_delta_binding.wat | 36 +- ...k_account_was_procedure_called_binding.hir | 16 +- ..._account_was_procedure_called_binding.masm | 8 +- ...k_account_was_procedure_called_binding.wat | 40 +- ...rust_sdk_input_note_get_assets_binding.hir | 1235 +++++---- ...ust_sdk_input_note_get_assets_binding.masm | 849 +++---- ...rust_sdk_input_note_get_assets_binding.wat | 300 ++- ...sdk_input_note_get_assets_info_binding.hir | 4 +- ...dk_input_note_get_assets_info_binding.masm | 4 +- ...sdk_input_note_get_assets_info_binding.wat | 36 +- ...sdk_input_note_get_inputs_info_binding.hir | 4 +- ...dk_input_note_get_inputs_info_binding.masm | 4 +- ...sdk_input_note_get_inputs_info_binding.wat | 36 +- ...st_sdk_input_note_get_metadata_binding.hir | 4 +- ...t_sdk_input_note_get_metadata_binding.masm | 4 +- ...st_sdk_input_note_get_metadata_binding.wat | 40 +- ...t_sdk_input_note_get_recipient_binding.hir | 4 +- ..._sdk_input_note_get_recipient_binding.masm | 4 +- ...t_sdk_input_note_get_recipient_binding.wat | 44 +- ...sdk_input_note_get_script_root_binding.hir | 4 +- ...dk_input_note_get_script_root_binding.masm | 4 +- ...sdk_input_note_get_script_root_binding.wat | 40 +- ...rust_sdk_input_note_get_sender_binding.wat | 36 +- ...k_input_note_get_serial_number_binding.hir | 4 +- ..._input_note_get_serial_number_binding.masm | 4 +- ...k_input_note_get_serial_number_binding.wat | 40 +- ...sdk_note_add_assets_to_account_binding.wat | 36 +- ...rust_sdk_output_note_add_asset_binding.wat | 32 +- .../rust_sdk_output_note_create_binding.wat | 36 +- ...ust_sdk_output_note_get_assets_binding.hir | 1235 +++++---- ...st_sdk_output_note_get_assets_binding.masm | 849 +++---- ...ust_sdk_output_note_get_assets_binding.wat | 300 ++- ...dk_output_note_get_assets_info_binding.hir | 4 +- ...k_output_note_get_assets_info_binding.masm | 4 +- ...dk_output_note_get_assets_info_binding.wat | 36 +- ...t_sdk_output_note_get_metadata_binding.hir | 4 +- ..._sdk_output_note_get_metadata_binding.masm | 4 +- ...t_sdk_output_note_get_metadata_binding.wat | 40 +- ..._sdk_output_note_get_recipient_binding.hir | 4 +- ...sdk_output_note_get_recipient_binding.masm | 4 +- ..._sdk_output_note_get_recipient_binding.wat | 44 +- .../rust_sdk/rust_sdk_swapp_note_bindings.hir | 316 +-- .../rust_sdk_swapp_note_bindings.masm | 90 +- .../rust_sdk/rust_sdk_swapp_note_bindings.wat | 74 +- .../expected/rust_sdk_stdlib_sha256_hash.hir | 1002 +++++--- .../expected/rust_sdk_stdlib_sha256_hash.masm | 587 ++++- .../expected/rust_sdk_stdlib_sha256_hash.wat | 214 +- .../expected/rust_sdk_stdlib_smt_get.hir | 646 ++--- .../expected/rust_sdk_stdlib_smt_get.masm | 121 +- .../expected/rust_sdk_stdlib_smt_get.wat | 47 +- .../expected/rust_sdk_stdlib_smt_set.hir | 692 ++--- .../expected/rust_sdk_stdlib_smt_set.masm | 139 +- .../expected/rust_sdk_stdlib_smt_set.wat | 57 +- tests/integration/expected/types/array.hir | 112 +- tests/integration/expected/types/array.masm | 44 +- tests/integration/expected/types/array.wat | 28 +- tests/integration/expected/types/enum.hir | 72 +- tests/integration/expected/types/enum.masm | 68 +- tests/integration/expected/types/enum.wat | 42 +- .../integration/expected/types/static_mut.hir | 108 +- .../expected/types/static_mut.masm | 110 +- .../integration/expected/types/static_mut.wat | 26 +- tests/integration/expected/vec_alloc_vec.hir | 430 ++-- tests/integration/expected/vec_alloc_vec.masm | 69 +- tests/integration/expected/vec_alloc_vec.wat | 48 +- 203 files changed, 17820 insertions(+), 16569 deletions(-) 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 1e19edb20..a8fd20bad 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir @@ -1,92 +1,92 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @abi_transform_tx_kernel_get_id { - public builtin.function @entrypoint(v0: i32) { - ^block4(v0: i32): - v2 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__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 @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; - v9 = arith.constant 8 : i32; - v10 = arith.add v6, v9 : 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(v10) - v12 = arith.constant 8 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v227 = arith.constant 8 : u32; - v15 = arith.mod v13, v227 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v18 = hir.bitcast v0 : u32; - v19 = arith.constant 4 : u32; - v20 = arith.mod v18, v19 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - hir.store v21, v17; - v226 = arith.constant 16 : i32; - v23 = arith.add v6, v226 : i32 #[overflow = wrapping]; - v24 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v25 = hir.bitcast v24 : ptr; - hir.store v25, v23; - builtin.ret ; - }; - - private builtin.function @__rustc::__rust_alloc(v26: i32, v27: i32) -> i32 { - ^block6(v26: i32, v27: i32): - v29 = arith.constant 1048580 : i32; - v30 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::alloc(v29, v27, v26) : i32 - builtin.ret v30; + 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; }; - private builtin.function @__rustc::__rust_realloc(v31: i32, v32: i32, v33: i32, v34: i32) -> i32 { - ^block8(v31: i32, v32: i32, v33: i32, v34: i32): - v36 = arith.constant 1048580 : i32; - v37 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::alloc(v36, v33, v34) : i32 - v236 = arith.constant 0 : i32; - v38 = arith.constant 0 : i32; - v39 = arith.eq v37, v38 : i1; - v40 = arith.zext v39 : u32; - v41 = hir.bitcast v40 : i32; - v43 = arith.neq v41, v236 : i1; - scf.if v43{ - ^block10: + 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: scf.yield ; } else { - ^block11: - v235 = arith.constant 0 : i32; - v45 = hir.bitcast v32 : u32; - v44 = hir.bitcast v34 : u32; - v46 = arith.lt v44, v45 : i1; - v47 = arith.zext v46 : u32; - v48 = hir.bitcast v47 : i32; - v50 = arith.neq v48, v235 : i1; - v51 = cf.select v50, v34, v32 : i32; + ^block9: v233 = arith.constant 0 : i32; - v234 = arith.constant 0 : i32; - v53 = arith.eq v51, v234 : i1; - v54 = arith.zext v53 : u32; - v55 = hir.bitcast v54 : i32; - v57 = arith.neq v55, v233 : i1; - scf.if v57{ + 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: scf.yield ; } else { - ^block12: - v58 = hir.bitcast v51 : u32; - v59 = hir.bitcast v37 : u32; - v60 = hir.int_to_ptr v59 : ptr; - v61 = hir.bitcast v31 : u32; - v62 = hir.int_to_ptr v61 : ptr; - hir.mem_cpy v62, v60, v58; + ^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; scf.yield ; }; scf.yield ; }; - builtin.ret v37; + builtin.ret v11; + }; + + 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; + builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -117,7 +117,7 @@ builtin.component root_ns:root@1.0.0 { scf.yield v243, v239; } else { ^block18: - v85 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/core::ptr::alignment::Alignment::max(v65, v78) : i32 + 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]; @@ -254,7 +254,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v172: i32, v173: i32) -> i32 { + private builtin.function @::max(v172: i32, v173: i32) -> i32 { ^block30(v172: i32, v173: i32): v180 = arith.constant 0 : i32; v176 = hir.bitcast v173 : u32; @@ -293,56 +293,50 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v200; }; - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v201: i32, v202: i32, v203: i32, v204: i32) -> i32 { + 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 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/wit_bindgen::rt::cabi_realloc(v201, v202, v203, v204) : i32 - builtin.ret v206; - }; - - private builtin.function @wit_bindgen::rt::cabi_realloc(v207: i32, v208: i32, v209: i32, v210: i32) -> i32 { - ^block42(v207: i32, v208: i32, v209: i32, v210: i32): - v212 = arith.constant 0 : i32; - v213 = arith.neq v208, v212 : i1; - v291, v292, v293 = scf.if v213 : i32, i32, u32 { - ^block46: - v221 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__rustc::__rust_realloc(v207, v208, v209, v210) : 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 v221, v286, v282; + scf.yield v215, v286, v282; } else { - ^block47: + ^block45: v321 = arith.constant 0 : i32; v322 = arith.constant 0 : i32; - v215 = arith.eq v210, v322 : i1; - v216 = arith.zext v215 : u32; - v217 = hir.bitcast v216 : i32; - v219 = arith.neq v217, v321 : i1; - v309 = scf.if v219 : 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; } else { - ^block48: - v220 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/alloc::alloc::alloc(v209, v210) : i32 - scf.yield v220; + ^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; }; v318 = arith.constant 0 : u32; v287 = arith.constant 1 : u32; - v311 = cf.select v219, v287, v318 : u32; + v311 = cf.select v213, v287, v318 : u32; v319 = ub.poison i32 : i32; - v310 = cf.select v219, v209, v319 : i32; + v310 = cf.select v213, v203, v319 : i32; scf.yield v309, v310, v311; }; v298, v299 = scf.index_switch v293 : i32, u32 case 0 { - ^block45: + ^block43: v316 = arith.constant 0 : i32; - v224 = arith.neq v291, v316 : i1; + v218 = arith.neq v291, v316 : i1; v313 = arith.constant 1 : u32; v314 = arith.constant 0 : u32; - v308 = cf.select v224, v314, v313 : u32; + v308 = cf.select v218, v314, v313 : u32; v315 = ub.poison i32 : i32; - v307 = cf.select v224, v291, v315 : i32; + v307 = cf.select v218, v291, v315 : i32; scf.yield v307, v308; } default { @@ -359,6 +353,12 @@ builtin.component root_ns:root@1.0.0 { 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; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; 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 5b447bf58..9bd5ac881 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat @@ -1,7 +1,7 @@ (module $abi_transform_tx_kernel_get_id.wasm - (type (;0;) (func (param i32))) - (type (;1;) (func (param i32 i32) (result i32))) - (type (;2;) (func (param i32 i32 i32 i32) (result i32))) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32 i32 i32 i32) (result i32))) + (type (;2;) (func (param i32))) (type (;3;) (func)) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) @@ -13,33 +13,13 @@ (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 $entrypoint (;0;) (type 0) (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 8 - i32.add - call $miden_base_sys::bindings::active_account::get_id - local.get 0 - local.get 1 - i64.load offset=8 - i64.store align=4 - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) + (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_realloc (;2;) (type 2) (param i32 i32 i32 i32) (result i32) + (func $__rustc::__rust_realloc (;1;) (type 1) (param i32 i32 i32 i32) (result i32) block ;; label = @1 i32.const 1048580 local.get 2 @@ -64,6 +44,26 @@ end local.get 2 ) + (func $entrypoint (;2;) (type 2) (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 8 + i32.add + call $miden_base_sys::bindings::active_account::get_id + local.get 0 + local.get 1 + i64.load offset=8 + i64.store align=4 + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 3) return ) @@ -86,7 +86,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -142,7 +142,7 @@ (func $intrinsics::mem::heap_base (;5;) (type 5) (result i32) unreachable ) - (func $miden_base_sys::bindings::active_account::get_id (;6;) (type 0) (param i32) + (func $miden_base_sys::bindings::active_account::get_id (;6;) (type 2) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -162,7 +162,7 @@ i32.add global.set $__stack_pointer ) - (func $core::ptr::alignment::Alignment::max (;7;) (type 1) (param i32 i32) (result i32) + (func $::max (;7;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -170,30 +170,23 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;8;) (type 0) (param i32) + (func $miden::active_account::get_id (;8;) (type 2) (param i32) unreachable ) - (func $cabi_realloc (;9;) (type 2) (param i32 i32 i32 i32) (result i32) + (func $cabi_realloc (;9;) (type 1) (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 (;10;) (type 1) (param i32 i32) (result i32) + (func $alloc::alloc::alloc (;10;) (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 $cabi_realloc_wit_bindgen_0_46_0 (;11;) (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 - ) - (func $wit_bindgen::rt::cabi_realloc (;12;) (type 2) (param i32 i32 i32 i32) (result i32) + (func $wit_bindgen::rt::cabi_realloc (;11;) (type 1) (param i32 i32 i32 i32) (result i32) block ;; label = @1 block ;; label = @2 block ;; label = @3 @@ -221,5 +214,12 @@ end local.get 2 ) + (func $cabi_realloc_wit_bindgen_0_46_0 (;12;) (type 1) (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/abi_transform_tx_kernel_get_inputs_4.hir b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir index dc51a3bd1..29a16018b 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir @@ -1,252 +1,252 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @abi_transform_tx_kernel_get_inputs_4 { - public builtin.function @entrypoint() { - ^block4: - v1 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v2 = hir.bitcast v1 : ptr; - v3 = hir.load v2 : i32; - v4 = arith.constant 16 : i32; - v5 = arith.sub v3, v4 : i32 #[overflow = wrapping]; - v6 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v7 = hir.bitcast v6 : ptr; - hir.store v7, v5; - v8 = arith.constant 4 : i32; - v9 = arith.add v5, v8 : 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(v9) - v11 = arith.constant 12 : u32; - v10 = hir.bitcast v5 : u32; - v12 = arith.add v10, v11 : u32 #[overflow = checked]; - v13 = arith.constant 4 : u32; - v14 = arith.mod v12, v13 : u32; - hir.assertz v14 #[code = 250]; - v15 = hir.int_to_ptr v12 : ptr; - v16 = hir.load v15 : i32; - v17 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/>::from(v16) : felt - v765 = arith.constant 4 : i32; - v19 = 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(v17, v19) - v764 = arith.constant 0 : i32; - v0 = arith.constant 0 : i32; - v21 = arith.eq v16, v0 : i1; - v22 = arith.zext v21 : u32; - v23 = hir.bitcast v22 : i32; - v25 = arith.neq v23, v764 : i1; - v735 = scf.if v25 : u32 { - ^block112: - v731 = arith.constant 0 : u32; - scf.yield v731; - } else { - ^block7: - v27 = arith.constant 8 : u32; - v26 = hir.bitcast v5 : u32; - v28 = arith.add v26, v27 : u32 #[overflow = checked]; - v763 = arith.constant 4 : u32; - v30 = arith.mod v28, v763 : u32; - hir.assertz v30 #[code = 250]; - v31 = hir.int_to_ptr v28 : ptr; - v32 = hir.load v31 : i32; - v33 = hir.bitcast v32 : u32; - v762 = arith.constant 4 : u32; - v35 = arith.mod v33, v762 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - v37 = hir.load v36 : felt; - v38 = arith.constant -1 : i32; - v39 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v38) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v37, v39) - v761 = arith.constant 0 : i32; - v40 = arith.constant 1 : i32; - v41 = arith.eq v16, v40 : i1; - v42 = arith.zext v41 : u32; - v43 = hir.bitcast v42 : i32; - v45 = arith.neq v43, v761 : i1; - v737 = scf.if v45 : u32 { - ^block111: - v760 = arith.constant 0 : u32; - scf.yield v760; - } else { - ^block8: - v759 = arith.constant 4 : u32; - v46 = hir.bitcast v32 : u32; - v48 = arith.add v46, v759 : u32 #[overflow = checked]; - v758 = arith.constant 4 : u32; - v50 = arith.mod v48, v758 : u32; - hir.assertz v50 #[code = 250]; - v51 = hir.int_to_ptr v48 : ptr; - v52 = hir.load v51 : felt; - v757 = arith.constant 1 : i32; - v54 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v757) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v52, v54) - v756 = arith.constant 0 : i32; - v730 = arith.constant 2 : u32; - v56 = hir.bitcast v16 : u32; - v58 = arith.lte v56, v730 : i1; - v59 = arith.zext v58 : u32; - v60 = hir.bitcast v59 : i32; - v62 = arith.neq v60, v756 : i1; - v739 = scf.if v62 : u32 { - ^block110: - v755 = arith.constant 0 : u32; - scf.yield v755; - } else { - ^block9: - v754 = arith.constant 8 : u32; - v63 = hir.bitcast v32 : u32; - v65 = arith.add v63, v754 : u32 #[overflow = checked]; - v753 = arith.constant 4 : u32; - v67 = arith.mod v65, v753 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - v69 = hir.load v68 : felt; - v55 = arith.constant 2 : i32; - v71 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v55) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v69, v71) - v752 = arith.constant 0 : i32; - v72 = arith.constant 3 : i32; - v73 = arith.eq v16, v72 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v752 : i1; - scf.if v77{ - ^block109: - scf.yield ; - } else { - ^block10: - v751 = arith.constant 12 : u32; - v78 = hir.bitcast v32 : u32; - v80 = arith.add v78, v751 : u32 #[overflow = checked]; - v750 = arith.constant 4 : u32; - v82 = arith.mod v80, v750 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : felt; - v749 = arith.constant 3 : i32; - v86 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v749) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v84, v86) - v747 = arith.constant 4 : i32; - v748 = arith.constant 4 : i32; - v88 = arith.add v5, v748 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::deallocate(v88, v747, v747) - v746 = arith.constant 16 : i32; - v92 = arith.add v5, v746 : i32 #[overflow = wrapping]; - v93 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v94 = hir.bitcast v93 : ptr; - hir.store v94, v92; - scf.yield ; - }; - v733 = arith.constant 1 : u32; - v745 = arith.constant 0 : u32; - v743 = cf.select v77, v745, v733 : u32; - scf.yield v743; - }; - scf.yield v739; - }; - scf.yield v737; - }; - v744 = arith.constant 0 : u32; - v742 = arith.eq v735, v744 : i1; - cf.cond_br v742 ^block6, ^block114; - ^block6: - ub.unreachable ; - ^block114: - builtin.ret ; + 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_alloc(v95: i32, v96: i32) -> i32 { - ^block11(v95: i32, v96: i32): - v98 = arith.constant 1048608 : i32; - v99 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v98, v96, v95) : i32 - builtin.ret v99; - }; - - private builtin.function @__rustc::__rust_dealloc(v100: i32, v101: i32, v102: i32) { - ^block13(v100: i32, v101: i32, v102: i32): + 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(v103: i32, v104: i32, v105: i32, v106: i32) -> i32 { - ^block15(v103: i32, v104: i32, v105: i32, v106: i32): - v108 = arith.constant 1048608 : i32; - v109 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v108, v105, v106) : i32 - v774 = arith.constant 0 : i32; - v110 = arith.constant 0 : i32; - v111 = arith.eq v109, v110 : i1; - v112 = arith.zext v111 : u32; - v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v774 : i1; - scf.if v115{ - ^block17: + 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 + v732 = 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, v732 : i1; + scf.if v20{ + ^block10: scf.yield ; } else { - ^block18: - v773 = arith.constant 0 : i32; - v117 = hir.bitcast v104 : u32; - v116 = hir.bitcast v106 : u32; - v118 = arith.lt v116, v117 : i1; - v119 = arith.zext v118 : u32; - v120 = hir.bitcast v119 : i32; - v122 = arith.neq v120, v773 : i1; - v123 = cf.select v122, v106, v104 : i32; - v771 = arith.constant 0 : i32; - v772 = arith.constant 0 : i32; - v125 = arith.eq v123, v772 : i1; - v126 = arith.zext v125 : u32; - v127 = hir.bitcast v126 : i32; - v129 = arith.neq v127, v771 : i1; - scf.if v129{ - ^block119: + ^block11: + v731 = 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, v731 : i1; + v28 = cf.select v27, v11, v9 : i32; + v729 = arith.constant 0 : i32; + v730 = arith.constant 0 : i32; + v30 = arith.eq v28, v730 : i1; + v31 = arith.zext v30 : u32; + v32 = hir.bitcast v31 : i32; + v34 = arith.neq v32, v729 : i1; + scf.if v34{ + ^block109: scf.yield ; } else { - ^block19: - v130 = hir.bitcast v123 : u32; - v131 = hir.bitcast v109 : u32; - v132 = hir.int_to_ptr v131 : ptr; - v133 = hir.bitcast v103 : u32; - v134 = hir.int_to_ptr v133 : ptr; - hir.mem_cpy v134, v132, v130; + ^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 v109; + builtin.ret v14; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v136: i32, v137: i32) -> i32 { - ^block20(v136: i32, v137: i32): - v139 = arith.constant 1048608 : i32; - v140 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v139, v137, v136) : i32 - v783 = arith.constant 0 : i32; - v141 = arith.constant 0 : i32; - v142 = arith.eq v140, v141 : i1; - v143 = arith.zext v142 : u32; - v144 = hir.bitcast v143 : i32; - v146 = arith.neq v144, v783 : i1; - scf.if v146{ - ^block22: + 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 + v741 = 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, v741 : i1; + scf.if v51{ + ^block15: scf.yield ; } else { - ^block23: - v781 = arith.constant 0 : i32; - v782 = arith.constant 0 : i32; - v148 = arith.eq v136, v782 : i1; - v149 = arith.zext v148 : u32; - v150 = hir.bitcast v149 : i32; - v152 = arith.neq v150, v781 : i1; - scf.if v152{ - ^block122: + ^block16: + v739 = arith.constant 0 : i32; + v740 = arith.constant 0 : i32; + v53 = arith.eq v41, v740 : i1; + v54 = arith.zext v53 : u32; + v55 = hir.bitcast v54 : i32; + v57 = arith.neq v55, v739 : i1; + scf.if v57{ + ^block112: scf.yield ; } else { - ^block24: - v775 = arith.constant 0 : u8; - v155 = hir.bitcast v136 : u32; - v156 = hir.bitcast v140 : u32; - v157 = hir.int_to_ptr v156 : ptr; - hir.mem_set v157, v155, v775; + ^block17: + v733 = 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, v733; scf.yield ; }; scf.yield ; }; - builtin.ret v140; + 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 + v777 = arith.constant 4 : i32; + v83 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v777) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v81, v83) + v776 = 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, v776 : i1; + v747 = scf.if v89 : u32 { + ^block118: + v743 = arith.constant 0 : u32; + scf.yield v743; + } else { + ^block21: + v91 = arith.constant 8 : u32; + v90 = hir.bitcast v69 : u32; + v92 = arith.add v90, v91 : u32 #[overflow = checked]; + v775 = arith.constant 4 : u32; + v94 = arith.mod v92, v775 : u32; + hir.assertz v94 #[code = 250]; + v95 = hir.int_to_ptr v92 : ptr; + v96 = hir.load v95 : i32; + v97 = hir.bitcast v96 : u32; + v774 = arith.constant 4 : u32; + v99 = arith.mod v97, v774 : 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) + v773 = 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, v773 : i1; + v749 = scf.if v109 : u32 { + ^block117: + v772 = arith.constant 0 : u32; + scf.yield v772; + } else { + ^block22: + v771 = arith.constant 4 : u32; + v110 = hir.bitcast v96 : u32; + v112 = arith.add v110, v771 : u32 #[overflow = checked]; + v770 = arith.constant 4 : u32; + v114 = arith.mod v112, v770 : u32; + hir.assertz v114 #[code = 250]; + v115 = hir.int_to_ptr v112 : ptr; + v116 = hir.load v115 : felt; + v769 = arith.constant 1 : i32; + v118 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v769) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v116, v118) + v768 = arith.constant 0 : i32; + v742 = arith.constant 2 : u32; + v120 = hir.bitcast v80 : u32; + v122 = arith.lte v120, v742 : i1; + v123 = arith.zext v122 : u32; + v124 = hir.bitcast v123 : i32; + v126 = arith.neq v124, v768 : i1; + v751 = scf.if v126 : u32 { + ^block116: + v767 = arith.constant 0 : u32; + scf.yield v767; + } else { + ^block23: + v766 = arith.constant 8 : u32; + v127 = hir.bitcast v96 : u32; + v129 = arith.add v127, v766 : u32 #[overflow = checked]; + v765 = arith.constant 4 : u32; + v131 = arith.mod v129, v765 : 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) + v764 = 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, v764 : i1; + scf.if v141{ + ^block115: + scf.yield ; + } else { + ^block24: + v763 = arith.constant 12 : u32; + v142 = hir.bitcast v96 : u32; + v144 = arith.add v142, v763 : u32 #[overflow = checked]; + v762 = arith.constant 4 : u32; + v146 = arith.mod v144, v762 : u32; + hir.assertz v146 #[code = 250]; + v147 = hir.int_to_ptr v144 : ptr; + v148 = hir.load v147 : felt; + v761 = arith.constant 3 : i32; + v150 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v761) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v148, v150) + v759 = arith.constant 4 : i32; + v760 = arith.constant 4 : i32; + v152 = arith.add v69, v760 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v152, v759, v759) + v758 = arith.constant 16 : i32; + v156 = arith.add v69, v758 : 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 ; + }; + v745 = arith.constant 1 : u32; + v757 = arith.constant 0 : u32; + v755 = cf.select v141, v757, v745 : u32; + scf.yield v755; + }; + scf.yield v751; + }; + scf.yield v749; + }; + v756 = arith.constant 0 : u32; + v754 = arith.eq v747, v756 : i1; + cf.cond_br v754 ^block20, ^block120; + ^block20: + ub.unreachable ; + ^block120: + builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -258,27 +258,27 @@ builtin.component root_ns:root@1.0.0 { ^block27(v159: i32, v160: i32, v161: i32): v164 = arith.constant 16 : i32; v163 = arith.constant 0 : i32; - v785 = arith.constant 16 : u32; + v779 = arith.constant 16 : u32; v166 = hir.bitcast v160 : u32; - v168 = arith.gt v166, v785 : i1; + v168 = arith.gt v166, v779 : i1; v169 = arith.zext v168 : u32; v170 = hir.bitcast v169 : i32; v172 = arith.neq v170, v163 : i1; v173 = cf.select v172, v160, v164 : i32; - v825 = arith.constant 0 : i32; + v819 = 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, v825 : i1; - v794, v795 = scf.if v178 : i32, u32 { + v178 = arith.neq v176, v819 : i1; + v788, v789 = scf.if v178 : i32, u32 { ^block127: - v786 = arith.constant 0 : u32; - v790 = ub.poison i32 : i32; - scf.yield v790, v786; + v780 = arith.constant 0 : u32; + v784 = ub.poison i32 : i32; + scf.yield v784, v780; } else { ^block30: - v180 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/core::ptr::alignment::Alignment::max(v160, v173) : i32 - v824 = arith.constant 0 : i32; + v180 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::max(v160, v173) : i32 + v818 = arith.constant 0 : i32; v179 = arith.constant -2147483648 : i32; v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; v183 = hir.bitcast v181 : u32; @@ -286,18 +286,18 @@ builtin.component root_ns:root@1.0.0 { v184 = arith.gt v182, v183 : i1; v185 = arith.zext v184 : u32; v186 = hir.bitcast v185 : i32; - v188 = arith.neq v186, v824 : i1; - v809 = scf.if v188 : i32 { + v188 = arith.neq v186, v818 : i1; + v803 = scf.if v188 : i32 { ^block126: - v823 = ub.poison i32 : i32; - scf.yield v823; + v817 = ub.poison i32 : i32; + scf.yield v817; } else { ^block31: - v821 = arith.constant 0 : i32; - v194 = arith.sub v821, v180 : i32 #[overflow = wrapping]; - v822 = arith.constant -1 : i32; + v815 = arith.constant 0 : i32; + v194 = arith.sub v815, v180 : i32 #[overflow = wrapping]; + v816 = arith.constant -1 : i32; v190 = arith.add v161, v180 : i32 #[overflow = wrapping]; - v192 = arith.add v190, v822 : i32 #[overflow = wrapping]; + v192 = arith.add v190, v816 : i32 #[overflow = wrapping]; v195 = arith.band v192, v194 : i32; v196 = hir.bitcast v159 : u32; v197 = arith.constant 4 : u32; @@ -305,8 +305,8 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v198 #[code = 250]; v199 = hir.int_to_ptr v196 : ptr; v200 = hir.load v199 : i32; - v820 = arith.constant 0 : i32; - v202 = arith.neq v200, v820 : i1; + v814 = arith.constant 0 : i32; + v202 = arith.neq v200, v814 : i1; scf.if v202{ ^block125: scf.yield ; @@ -315,41 +315,41 @@ builtin.component root_ns:root@1.0.0 { 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; - v819 = arith.constant 4 : u32; - v212 = arith.mod v210, v819 : u32; + v813 = arith.constant 4 : u32; + v212 = arith.mod v210, v813 : u32; hir.assertz v212 #[code = 250]; - v818 = arith.constant 16 : u32; + v812 = arith.constant 16 : u32; v205 = hir.bitcast v204 : i32; - v208 = arith.shl v205, v818 : i32; + v208 = arith.shl v205, v812 : 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; - v817 = arith.constant 4 : u32; - v218 = arith.mod v216, v817 : u32; + v811 = arith.constant 4 : u32; + v218 = arith.mod v216, v811 : u32; hir.assertz v218 #[code = 250]; v219 = hir.int_to_ptr v216 : ptr; v220 = hir.load v219 : i32; - v815 = arith.constant 0 : i32; - v816 = arith.constant -1 : i32; - v222 = arith.bxor v220, v816 : i32; + v809 = arith.constant 0 : i32; + v810 = arith.constant -1 : i32; + v222 = arith.bxor v220, v810 : 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, v815 : i1; - v808 = scf.if v229 : i32 { + v229 = arith.neq v227, v809 : i1; + v802 = scf.if v229 : i32 { ^block34: - v814 = arith.constant 0 : i32; - scf.yield v814; + v808 = arith.constant 0 : i32; + scf.yield v808; } else { ^block35: v231 = hir.bitcast v159 : u32; - v813 = arith.constant 4 : u32; - v233 = arith.mod v231, v813 : u32; + v807 = arith.constant 4 : u32; + v233 = arith.mod v231, v807 : u32; hir.assertz v233 #[code = 250]; v230 = arith.add v220, v195 : i32 #[overflow = wrapping]; v234 = hir.int_to_ptr v231 : ptr; @@ -357,20 +357,20 @@ builtin.component root_ns:root@1.0.0 { v236 = arith.add v220, v180 : i32 #[overflow = wrapping]; scf.yield v236; }; - scf.yield v808; + scf.yield v802; }; - v791 = arith.constant 1 : u32; - v812 = arith.constant 0 : u32; - v810 = cf.select v188, v812, v791 : u32; - scf.yield v809, v810; + v785 = arith.constant 1 : u32; + v806 = arith.constant 0 : u32; + v804 = cf.select v188, v806, v785 : u32; + scf.yield v803, v804; }; - v811 = arith.constant 0 : u32; - v807 = arith.eq v795, v811 : i1; - cf.cond_br v807 ^block29, ^block129(v794); + v805 = arith.constant 0 : u32; + v801 = arith.eq v789, v805 : i1; + cf.cond_br v801 ^block29, ^block129(v788); ^block29: ub.unreachable ; - ^block129(v787: i32): - builtin.ret v787; + ^block129(v781: i32): + builtin.ret v781; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -379,7 +379,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v239; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v241: i32, v242: i32, v243: i32) { + 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; @@ -393,7 +393,7 @@ builtin.component root_ns:root@1.0.0 { 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/alloc::raw_vec::RawVecInner::try_allocate_in(v253, v254, v244, v242, v243) + 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]; @@ -402,706 +402,701 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v260 #[code = 250]; v261 = hir.int_to_ptr v258 : ptr; v262 = hir.load v261 : i32; - v836 = arith.constant 4 : u32; + v830 = arith.constant 4 : u32; v263 = hir.bitcast v249 : u32; - v265 = arith.add v263, v836 : u32 #[overflow = checked]; - v835 = arith.constant 4 : u32; - v267 = arith.mod v265, v835 : u32; + v265 = arith.add v263, v830 : u32 #[overflow = checked]; + v829 = arith.constant 4 : u32; + v267 = arith.mod v265, v829 : u32; hir.assertz v267 #[code = 250]; v268 = hir.int_to_ptr v265 : ptr; v269 = hir.load v268 : i32; - v834 = arith.constant 0 : i32; + v828 = 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, v834 : i1; + v275 = arith.neq v273, v828 : i1; cf.cond_br v275 ^block42, ^block43; ^block42: - v285 = arith.constant 12 : u32; - v284 = hir.bitcast v249 : u32; - v286 = arith.add v284, v285 : u32 #[overflow = checked]; - v833 = arith.constant 4 : u32; - v288 = arith.mod v286, v833 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - v290 = hir.load v289 : i32; - v832 = arith.constant 4 : u32; - v291 = hir.bitcast v241 : u32; - v293 = arith.add v291, v832 : u32 #[overflow = checked]; - v831 = arith.constant 4 : u32; - v295 = arith.mod v293, v831 : u32; - hir.assertz v295 #[code = 250]; - v296 = hir.int_to_ptr v293 : ptr; - hir.store v296, v290; - v297 = hir.bitcast v241 : u32; - v830 = arith.constant 4 : u32; - v299 = arith.mod v297, v830 : u32; - hir.assertz v299 #[code = 250]; - v300 = hir.int_to_ptr v297 : ptr; - hir.store v300, v262; - v829 = arith.constant 16 : i32; - v302 = arith.add v249, v829 : i32 #[overflow = wrapping]; - v303 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v304 = hir.bitcast v303 : ptr; - hir.store v304, v302; + v284 = arith.constant 12 : u32; + v283 = hir.bitcast v249 : u32; + v285 = arith.add v283, v284 : u32 #[overflow = checked]; + v827 = arith.constant 4 : u32; + v287 = arith.mod v285, v827 : u32; + hir.assertz v287 #[code = 250]; + v288 = hir.int_to_ptr v285 : ptr; + v289 = hir.load v288 : i32; + v826 = arith.constant 4 : u32; + v290 = hir.bitcast v241 : u32; + v292 = arith.add v290, v826 : u32 #[overflow = checked]; + v825 = arith.constant 4 : u32; + v294 = arith.mod v292, v825 : u32; + hir.assertz v294 #[code = 250]; + v295 = hir.int_to_ptr v292 : ptr; + hir.store v295, v289; + v296 = hir.bitcast v241 : u32; + v824 = arith.constant 4 : u32; + v298 = arith.mod v296, v824 : u32; + hir.assertz v298 #[code = 250]; + v299 = hir.int_to_ptr v296 : ptr; + hir.store v299, v262; + v823 = arith.constant 16 : i32; + v301 = arith.add v249, v823 : 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: - v828 = arith.constant 12 : u32; + v822 = arith.constant 12 : u32; v276 = hir.bitcast v249 : u32; - v278 = arith.add v276, v828 : u32 #[overflow = checked]; - v827 = arith.constant 4 : u32; - v280 = arith.mod v278, v827 : u32; + v278 = arith.add v276, v822 : u32 #[overflow = checked]; + v821 = arith.constant 4 : u32; + v280 = arith.mod v278, v821 : u32; hir.assertz v280 #[code = 250]; v281 = hir.int_to_ptr v278 : ptr; v282 = hir.load v281 : i32; - v283 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::handle_error(v262, v282, v283) + 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 @miden_base_sys::bindings::active_note::get_inputs(v305: i32) { - ^block44(v305: i32): - v307 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v308 = hir.bitcast v307 : ptr; - v309 = hir.load v308 : i32; - v310 = arith.constant 16 : i32; - v311 = arith.sub v309, v310 : i32 #[overflow = wrapping]; - v312 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v313 = hir.bitcast v312 : ptr; - hir.store v313, v311; - v316 = arith.constant 4 : i32; - v314 = arith.constant 8 : i32; - v315 = arith.add v311, v314 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::with_capacity_in(v315, v316, v316) - v319 = arith.constant 8 : u32; - v318 = hir.bitcast v311 : u32; - v320 = arith.add v318, v319 : u32 #[overflow = checked]; - v321 = arith.constant 4 : u32; - v322 = arith.mod v320, v321 : u32; - hir.assertz v322 #[code = 250]; - v323 = hir.int_to_ptr v320 : ptr; - v324 = hir.load v323 : i32; - v326 = arith.constant 12 : u32; - v325 = hir.bitcast v311 : u32; - v327 = arith.add v325, v326 : u32 #[overflow = checked]; - v844 = arith.constant 4 : u32; - v329 = arith.mod v327, v844 : u32; - hir.assertz v329 #[code = 250]; - v330 = hir.int_to_ptr v327 : ptr; - v331 = hir.load v330 : i32; - v837 = arith.constant 2 : u32; - v333 = hir.bitcast v331 : u32; - v335 = arith.shr v333, v837 : u32; - v336 = hir.bitcast v335 : i32; - v337 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::active_note::get_inputs(v336) : i32 - v843 = arith.constant 8 : u32; - v338 = hir.bitcast v305 : u32; - v340 = arith.add v338, v843 : u32 #[overflow = checked]; - v842 = arith.constant 4 : u32; - v342 = arith.mod v340, v842 : u32; - hir.assertz v342 #[code = 250]; - v343 = hir.int_to_ptr v340 : ptr; - hir.store v343, v337; - v841 = arith.constant 4 : u32; - v344 = hir.bitcast v305 : u32; - v346 = arith.add v344, v841 : u32 #[overflow = checked]; - v840 = arith.constant 4 : u32; - v348 = arith.mod v346, v840 : u32; - hir.assertz v348 #[code = 250]; - v349 = hir.int_to_ptr v346 : ptr; - hir.store v349, v331; - v350 = hir.bitcast v305 : u32; - v839 = arith.constant 4 : u32; - v352 = arith.mod v350, v839 : u32; - hir.assertz v352 #[code = 250]; - v353 = hir.int_to_ptr v350 : ptr; - hir.store v353, v324; - v838 = arith.constant 16 : i32; - v355 = arith.add v311, v838 : i32 #[overflow = wrapping]; - v356 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v357 = hir.bitcast v356 : ptr; - hir.store v357, v355; + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v304: i32) { + ^block44(v304: i32): + v306 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v307 = hir.bitcast v306 : ptr; + v308 = hir.load v307 : i32; + v309 = arith.constant 16 : i32; + v310 = arith.sub v308, v309 : i32 #[overflow = wrapping]; + v311 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v312 = hir.bitcast v311 : ptr; + hir.store v312, v310; + v315 = arith.constant 4 : i32; + v313 = arith.constant 8 : i32; + v314 = arith.add v310, v313 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::with_capacity_in(v314, v315, v315) + v318 = arith.constant 8 : u32; + v317 = hir.bitcast v310 : u32; + v319 = arith.add v317, v318 : u32 #[overflow = checked]; + v320 = arith.constant 4 : u32; + v321 = arith.mod v319, v320 : u32; + hir.assertz v321 #[code = 250]; + v322 = hir.int_to_ptr v319 : ptr; + v323 = hir.load v322 : i32; + v325 = arith.constant 12 : u32; + v324 = hir.bitcast v310 : u32; + v326 = arith.add v324, v325 : u32 #[overflow = checked]; + v838 = arith.constant 4 : u32; + v328 = arith.mod v326, v838 : u32; + hir.assertz v328 #[code = 250]; + v329 = hir.int_to_ptr v326 : ptr; + v330 = hir.load v329 : i32; + v831 = arith.constant 2 : u32; + v332 = hir.bitcast v330 : u32; + v334 = arith.shr v332, v831 : u32; + v335 = hir.bitcast v334 : i32; + v336 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::active_note::get_inputs(v335) : i32 + v837 = arith.constant 8 : u32; + v337 = hir.bitcast v304 : u32; + v339 = arith.add v337, v837 : u32 #[overflow = checked]; + v836 = arith.constant 4 : u32; + v341 = arith.mod v339, v836 : u32; + hir.assertz v341 #[code = 250]; + v342 = hir.int_to_ptr v339 : ptr; + hir.store v342, v336; + v835 = arith.constant 4 : u32; + v343 = hir.bitcast v304 : u32; + v345 = arith.add v343, v835 : u32 #[overflow = checked]; + v834 = arith.constant 4 : u32; + v347 = arith.mod v345, v834 : u32; + hir.assertz v347 #[code = 250]; + v348 = hir.int_to_ptr v345 : ptr; + hir.store v348, v330; + v349 = hir.bitcast v304 : u32; + v833 = arith.constant 4 : u32; + v351 = arith.mod v349, v833 : u32; + hir.assertz v351 #[code = 250]; + v352 = hir.int_to_ptr v349 : ptr; + hir.store v352, v323; + v832 = arith.constant 16 : i32; + v354 = arith.add v310, v832 : i32 #[overflow = wrapping]; + v355 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v356 = hir.bitcast v355 : ptr; + hir.store v356, v354; builtin.ret ; }; - private builtin.function @>::from(v358: i32) -> felt { - ^block46(v358: i32): - v360 = hir.bitcast v358 : felt; - builtin.ret v360; + private builtin.function @>::from(v357: i32) -> felt { + ^block46(v357: i32): + v359 = hir.bitcast v357 : felt; + builtin.ret v359; }; - private builtin.function @intrinsics::felt::from_u32(v361: i32) -> felt { - ^block48(v361: i32): - v362 = hir.bitcast v361 : felt; - builtin.ret v362; + private builtin.function @intrinsics::felt::assert_eq(v360: felt, v361: felt) { + ^block48(v360: felt, v361: felt): + hir.assert_eq v360, v361; + builtin.ret ; }; - private builtin.function @intrinsics::felt::assert_eq(v364: felt, v365: felt) { - ^block50(v364: felt, v365: felt): - hir.assert_eq v364, v365; - builtin.ret ; + private builtin.function @intrinsics::felt::from_u32(v362: i32) -> felt { + ^block50(v362: i32): + v363 = hir.bitcast v362 : felt; + builtin.ret v363; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v366: i32, v367: i32, v368: i32) { - ^block52(v366: i32, v367: i32, v368: i32): - v370 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v371 = hir.bitcast v370 : ptr; - v372 = hir.load v371 : i32; - v373 = arith.constant 16 : i32; - v374 = arith.sub v372, v373 : i32 #[overflow = wrapping]; - v375 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v376 = hir.bitcast v375 : ptr; - hir.store v376, v374; - v377 = arith.constant 4 : i32; - v378 = arith.add v374, v377 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::current_memory(v378, v366, v367, v368) - v380 = arith.constant 8 : u32; - v379 = hir.bitcast v374 : u32; - v381 = arith.add v379, v380 : u32 #[overflow = checked]; - v382 = arith.constant 4 : u32; - v383 = arith.mod v381, v382 : u32; - hir.assertz v383 #[code = 250]; - v384 = hir.int_to_ptr v381 : ptr; - v385 = hir.load v384 : i32; - v851 = arith.constant 0 : i32; + private builtin.function @::alloc_impl(v365: i32, v366: i32, v367: i32, v368: i32) { + ^block52(v365: i32, v366: i32, v367: i32, v368: i32): + v854 = arith.constant 0 : i32; v369 = arith.constant 0 : i32; - v387 = arith.eq v385, v369 : i1; - v388 = arith.zext v387 : u32; - v389 = hir.bitcast v388 : i32; - v391 = arith.neq v389, v851 : i1; - scf.if v391{ + v370 = arith.eq v367, v369 : i1; + v371 = arith.zext v370 : u32; + v372 = hir.bitcast v371 : i32; + v374 = arith.neq v372, v854 : i1; + v850 = scf.if v374 : i32 { ^block135: - scf.yield ; + scf.yield v366; } else { ^block55: - v850 = arith.constant 4 : u32; - v392 = hir.bitcast v374 : u32; - v394 = arith.add v392, v850 : u32 #[overflow = checked]; - v849 = arith.constant 4 : u32; - v396 = arith.mod v394, v849 : u32; - hir.assertz v396 #[code = 250]; - v397 = hir.int_to_ptr v394 : ptr; - v398 = hir.load v397 : i32; - v400 = arith.constant 12 : u32; - v399 = hir.bitcast v374 : u32; - v401 = arith.add v399, v400 : u32 #[overflow = checked]; - v848 = arith.constant 4 : u32; - v403 = arith.mod v401, v848 : u32; - hir.assertz v403 #[code = 250]; - v404 = hir.int_to_ptr v401 : ptr; - v405 = hir.load v404 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v398, v385, v405) - scf.yield ; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v853 = arith.constant 0 : i32; + v376 = arith.neq v368, v853 : i1; + v849 = scf.if v376 : i32 { + ^block56: + v378 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v367, v366) : i32 + scf.yield v378; + } else { + ^block57: + v377 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v367, v366) : i32 + scf.yield v377; + }; + scf.yield v849; }; - v847 = arith.constant 16 : i32; - v408 = arith.add v374, v847 : i32 #[overflow = wrapping]; - v409 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v410 = hir.bitcast v409 : ptr; - hir.store v410, v408; + v382 = arith.constant 4 : u32; + v381 = hir.bitcast v365 : u32; + v383 = arith.add v381, v382 : u32 #[overflow = checked]; + v852 = arith.constant 4 : u32; + v385 = arith.mod v383, v852 : u32; + hir.assertz v385 #[code = 250]; + v386 = hir.int_to_ptr v383 : ptr; + hir.store v386, v367; + v388 = hir.bitcast v365 : u32; + v851 = arith.constant 4 : u32; + v390 = arith.mod v388, v851 : u32; + hir.assertz v390 #[code = 250]; + v391 = hir.int_to_ptr v388 : ptr; + hir.store v391, v850; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v411: i32, v412: i32, v413: i32, v414: i32, v415: i32) { - ^block56(v411: i32, v412: i32, v413: i32, v414: i32, v415: i32): - v418 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v419 = hir.bitcast v418 : ptr; - v420 = hir.load v419 : i32; - v421 = arith.constant 16 : i32; - v422 = arith.sub v420, v421 : i32 #[overflow = wrapping]; - v423 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v424 = hir.bitcast v423 : ptr; - hir.store v424, v422; - v434 = hir.bitcast v412 : u32; - v435 = arith.zext v434 : u64; - v436 = hir.bitcast v435 : i64; - v416 = arith.constant 0 : i32; - v429 = arith.sub v416, v414 : i32 #[overflow = wrapping]; - v426 = arith.constant -1 : i32; - v425 = arith.add v414, v415 : i32 #[overflow = wrapping]; - v427 = arith.add v425, v426 : i32 #[overflow = wrapping]; - v430 = arith.band v427, v429 : i32; - v431 = hir.bitcast v430 : u32; - v432 = arith.zext v431 : u64; - v433 = hir.bitcast v432 : i64; - v437 = arith.mul v433, v436 : i64 #[overflow = wrapping]; - v955 = arith.constant 0 : i32; - v438 = arith.constant 32 : i64; - v440 = hir.cast v438 : u32; - v439 = hir.bitcast v437 : u64; - v441 = arith.shr v439, v440 : u64; - v442 = hir.bitcast v441 : i64; - v443 = arith.trunc v442 : i32; - v445 = arith.neq v443, v955 : i1; - v867, v868, v869, v870, v871, v872 = scf.if v445 : i32, i32, i32, i32, i32, u32 { - ^block137: - v852 = arith.constant 0 : u32; - v859 = ub.poison i32 : i32; - scf.yield v411, v422, v859, v859, v859, v852; + private builtin.function @::deallocate(v392: i32, v393: i32, v394: i32) { + ^block58(v392: i32, v393: i32, v394: i32): + v396 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v397 = hir.bitcast v396 : ptr; + v398 = hir.load v397 : i32; + v399 = arith.constant 16 : i32; + v400 = arith.sub v398, v399 : i32 #[overflow = wrapping]; + v401 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v402 = hir.bitcast v401 : ptr; + hir.store v402, v400; + v403 = arith.constant 4 : i32; + v404 = arith.add v400, v403 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::current_memory(v404, v392, v393, v394) + v406 = arith.constant 8 : u32; + v405 = hir.bitcast v400 : u32; + v407 = arith.add v405, v406 : u32 #[overflow = checked]; + v408 = arith.constant 4 : u32; + v409 = arith.mod v407, v408 : u32; + hir.assertz v409 #[code = 250]; + v410 = hir.int_to_ptr v407 : ptr; + v411 = hir.load v410 : i32; + v861 = arith.constant 0 : i32; + v395 = arith.constant 0 : i32; + v413 = arith.eq v411, v395 : i1; + v414 = arith.zext v413 : u32; + v415 = hir.bitcast v414 : i32; + v417 = arith.neq v415, v861 : i1; + scf.if v417{ + ^block138: + scf.yield ; } else { ^block61: - v446 = arith.trunc v437 : i32; - v954 = arith.constant 0 : i32; - v447 = arith.constant -2147483648 : i32; - v448 = arith.sub v447, v414 : i32 #[overflow = wrapping]; - v450 = hir.bitcast v448 : u32; - v449 = hir.bitcast v446 : u32; - v451 = arith.lte v449, v450 : i1; - v452 = arith.zext v451 : u32; - v453 = hir.bitcast v452 : i32; - v455 = arith.neq v453, v954 : i1; - v915 = scf.if v455 : i32 { - ^block59: - v953 = arith.constant 0 : i32; - v466 = arith.neq v446, v953 : i1; - v914 = scf.if v466 : i32 { - ^block63: - v952 = arith.constant 0 : i32; - v482 = arith.neq v413, v952 : i1; - v913 = scf.if v482 : i32 { - ^block66: - v464 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v422, v414, v446, v464) - v493 = hir.bitcast v422 : u32; - v538 = arith.constant 4 : u32; - v495 = arith.mod v493, v538 : u32; - hir.assertz v495 #[code = 250]; - v496 = hir.int_to_ptr v493 : ptr; - v497 = hir.load v496 : i32; - scf.yield v497; - } else { - ^block67: - v483 = arith.constant 8 : i32; - v484 = arith.add v422, v483 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v484, v414, v446) - v468 = arith.constant 8 : u32; - v485 = hir.bitcast v422 : u32; - v487 = arith.add v485, v468 : u32 #[overflow = checked]; - v951 = arith.constant 4 : u32; - v489 = arith.mod v487, v951 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - v491 = hir.load v490 : i32; - scf.yield v491; - }; - v949 = arith.constant 0 : i32; - v950 = arith.constant 0 : i32; - v500 = arith.eq v913, v950 : i1; - v501 = arith.zext v500 : u32; - v502 = hir.bitcast v501 : i32; - v504 = arith.neq v502, v949 : i1; - scf.if v504{ - ^block68: - v948 = arith.constant 8 : u32; - v521 = hir.bitcast v411 : u32; - v523 = arith.add v521, v948 : u32 #[overflow = checked]; - v947 = arith.constant 4 : u32; - v525 = arith.mod v523, v947 : u32; - hir.assertz v525 #[code = 250]; - v526 = hir.int_to_ptr v523 : ptr; - hir.store v526, v446; - v946 = arith.constant 4 : u32; - v528 = hir.bitcast v411 : u32; - v530 = arith.add v528, v946 : u32 #[overflow = checked]; - v945 = arith.constant 4 : u32; - v532 = arith.mod v530, v945 : u32; - hir.assertz v532 #[code = 250]; - v533 = hir.int_to_ptr v530 : ptr; - hir.store v533, v414; - scf.yield ; - } else { - ^block69: - v944 = arith.constant 8 : u32; - v506 = hir.bitcast v411 : u32; - v508 = arith.add v506, v944 : u32 #[overflow = checked]; - v943 = arith.constant 4 : u32; - v510 = arith.mod v508, v943 : u32; - hir.assertz v510 #[code = 250]; - v511 = hir.int_to_ptr v508 : ptr; - hir.store v511, v913; - v942 = arith.constant 4 : u32; - v513 = hir.bitcast v411 : u32; - v515 = arith.add v513, v942 : u32 #[overflow = checked]; - v941 = arith.constant 4 : u32; - v517 = arith.mod v515, v941 : u32; - hir.assertz v517 #[code = 250]; - v518 = hir.int_to_ptr v515 : ptr; - hir.store v518, v412; - scf.yield ; - }; - v939 = arith.constant 0 : i32; - v940 = arith.constant 1 : i32; - v912 = cf.select v504, v940, v939 : i32; - scf.yield v912; - } else { - ^block64: - v938 = arith.constant 8 : u32; - v467 = hir.bitcast v411 : u32; - v469 = arith.add v467, v938 : u32 #[overflow = checked]; - v937 = arith.constant 4 : u32; - v471 = arith.mod v469, v937 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - hir.store v472, v414; - v936 = arith.constant 4 : u32; - v475 = hir.bitcast v411 : u32; - v477 = arith.add v475, v936 : u32 #[overflow = checked]; - v935 = arith.constant 4 : u32; - v479 = arith.mod v477, v935 : u32; - hir.assertz v479 #[code = 250]; - v934 = arith.constant 0 : i32; - v480 = hir.int_to_ptr v477 : ptr; - hir.store v480, v934; - v933 = arith.constant 0 : i32; - scf.yield v933; - }; - scf.yield v914; - } else { - ^block62: - v932 = ub.poison i32 : i32; - scf.yield v932; - }; - v927 = arith.constant 0 : u32; - v860 = arith.constant 1 : u32; - v920 = cf.select v455, v860, v927 : u32; - v928 = ub.poison i32 : i32; - v919 = cf.select v455, v422, v928 : i32; - v929 = ub.poison i32 : i32; - v918 = cf.select v455, v411, v929 : i32; - v930 = ub.poison i32 : i32; - v917 = cf.select v455, v930, v422 : i32; - v931 = ub.poison i32 : i32; - v916 = cf.select v455, v931, v411 : i32; - scf.yield v916, v917, v918, v915, v919, v920; - }; - v873, v874, v875 = scf.index_switch v872 : i32, i32, i32 - case 0 { - ^block60: - v926 = arith.constant 4 : u32; - v458 = hir.bitcast v867 : u32; - v460 = arith.add v458, v926 : u32 #[overflow = checked]; - v925 = arith.constant 4 : u32; - v462 = arith.mod v460, v925 : u32; - hir.assertz v462 #[code = 250]; - v924 = arith.constant 0 : i32; - v463 = hir.int_to_ptr v460 : ptr; - hir.store v463, v924; - v923 = arith.constant 1 : i32; - scf.yield v867, v923, v868; - } - default { - ^block141: - scf.yield v869, v870, v871; + v860 = arith.constant 4 : u32; + v418 = hir.bitcast v400 : u32; + v420 = arith.add v418, v860 : u32 #[overflow = checked]; + v859 = arith.constant 4 : u32; + v422 = arith.mod v420, v859 : u32; + hir.assertz v422 #[code = 250]; + v423 = hir.int_to_ptr v420 : ptr; + v424 = hir.load v423 : i32; + v426 = arith.constant 12 : u32; + v425 = hir.bitcast v400 : u32; + v427 = arith.add v425, v426 : u32 #[overflow = checked]; + v858 = arith.constant 4 : u32; + v429 = arith.mod v427, v858 : u32; + hir.assertz v429 #[code = 250]; + v430 = hir.int_to_ptr v427 : ptr; + v431 = hir.load v430 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v424, v411, v431) + scf.yield ; }; - v537 = hir.bitcast v873 : u32; - v922 = arith.constant 4 : u32; - v539 = arith.mod v537, v922 : u32; - hir.assertz v539 #[code = 250]; - v540 = hir.int_to_ptr v537 : ptr; - hir.store v540, v874; - v921 = arith.constant 16 : i32; - v545 = arith.add v875, v921 : i32 #[overflow = wrapping]; - v546 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v547 = hir.bitcast v546 : ptr; - hir.store v547, v545; - builtin.ret ; - }; - - private builtin.function @::allocate(v548: i32, v549: i32, v550: i32) { - ^block70(v548: i32, v549: i32, v550: i32): - v552 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v553 = hir.bitcast v552 : ptr; - v554 = hir.load v553 : i32; - v555 = arith.constant 16 : i32; - v556 = arith.sub v554, v555 : i32 #[overflow = wrapping]; - v557 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v558 = hir.bitcast v557 : ptr; - hir.store v558, v556; - v551 = arith.constant 0 : i32; - v559 = arith.constant 8 : i32; - v560 = arith.add v556, v559 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v560, v549, v550, v551) - v563 = arith.constant 12 : u32; - v562 = hir.bitcast v556 : u32; - v564 = arith.add v562, v563 : u32 #[overflow = checked]; - v565 = arith.constant 4 : u32; - v566 = arith.mod v564, v565 : u32; - hir.assertz v566 #[code = 250]; - v567 = hir.int_to_ptr v564 : ptr; - v568 = hir.load v567 : i32; - v570 = arith.constant 8 : u32; - v569 = hir.bitcast v556 : u32; - v571 = arith.add v569, v570 : u32 #[overflow = checked]; - v960 = arith.constant 4 : u32; - v573 = arith.mod v571, v960 : u32; - hir.assertz v573 #[code = 250]; - v574 = hir.int_to_ptr v571 : ptr; - v575 = hir.load v574 : i32; - v576 = hir.bitcast v548 : u32; - v959 = arith.constant 4 : u32; - v578 = arith.mod v576, v959 : u32; - hir.assertz v578 #[code = 250]; - v579 = hir.int_to_ptr v576 : ptr; - hir.store v579, v575; - v958 = arith.constant 4 : u32; - v580 = hir.bitcast v548 : u32; - v582 = arith.add v580, v958 : u32 #[overflow = checked]; - v957 = arith.constant 4 : u32; - v584 = arith.mod v582, v957 : u32; - hir.assertz v584 #[code = 250]; - v585 = hir.int_to_ptr v582 : ptr; - hir.store v585, v568; - v956 = arith.constant 16 : i32; - v587 = arith.add v556, v956 : i32 #[overflow = wrapping]; - v588 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v589 = hir.bitcast v588 : ptr; - hir.store v589, v587; + v857 = arith.constant 16 : i32; + v434 = arith.add v400, v857 : i32 #[overflow = wrapping]; + v435 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v436 = hir.bitcast v435 : ptr; + hir.store v436, v434; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v590: i32, v591: i32, v592: i32, v593: i32) { - ^block72(v590: i32, v591: i32, v592: i32, v593: i32): - v976 = arith.constant 0 : i32; - v594 = arith.constant 0 : i32; - v595 = arith.eq v592, v594 : i1; - v596 = arith.zext v595 : u32; - v597 = hir.bitcast v596 : i32; - v599 = arith.neq v597, v976 : i1; - v972 = scf.if v599 : i32 { - ^block144: - scf.yield v591; + private builtin.function @::current_memory(v437: i32, v438: i32, v439: i32, v440: i32) { + ^block62(v437: i32, v438: i32, v439: i32, v440: i32): + v887 = arith.constant 0 : i32; + v441 = arith.constant 0 : i32; + v445 = arith.eq v440, v441 : i1; + v446 = arith.zext v445 : u32; + v447 = hir.bitcast v446 : i32; + v449 = arith.neq v447, v887 : i1; + v874, v875 = scf.if v449 : i32, i32 { + ^block141: + v886 = arith.constant 0 : i32; + v443 = arith.constant 4 : i32; + scf.yield v443, v886; } else { - ^block75: - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v975 = arith.constant 0 : i32; - v601 = arith.neq v593, v975 : i1; - v971 = scf.if v601 : i32 { - ^block76: - v603 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v592, v591) : i32 - scf.yield v603; + ^block65: + v450 = hir.bitcast v438 : u32; + v485 = arith.constant 4 : u32; + v452 = arith.mod v450, v485 : u32; + hir.assertz v452 #[code = 250]; + v453 = hir.int_to_ptr v450 : ptr; + v454 = hir.load v453 : i32; + v884 = arith.constant 0 : i32; + v885 = arith.constant 0 : i32; + v456 = arith.eq v454, v885 : i1; + v457 = arith.zext v456 : u32; + v458 = hir.bitcast v457 : i32; + v460 = arith.neq v458, v884 : i1; + v872 = scf.if v460 : i32 { + ^block140: + v883 = arith.constant 0 : i32; + scf.yield v883; } else { - ^block77: - v602 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v592, v591) : i32 - scf.yield v602; + ^block66: + v882 = arith.constant 4 : u32; + v461 = hir.bitcast v437 : u32; + v463 = arith.add v461, v882 : u32 #[overflow = checked]; + v881 = arith.constant 4 : u32; + v465 = arith.mod v463, v881 : u32; + hir.assertz v465 #[code = 250]; + v466 = hir.int_to_ptr v463 : ptr; + hir.store v466, v439; + v880 = arith.constant 4 : u32; + v467 = hir.bitcast v438 : u32; + v469 = arith.add v467, v880 : u32 #[overflow = checked]; + v879 = arith.constant 4 : u32; + v471 = arith.mod v469, v879 : u32; + hir.assertz v471 #[code = 250]; + v472 = hir.int_to_ptr v469 : ptr; + v473 = hir.load v472 : i32; + v474 = hir.bitcast v437 : u32; + v878 = arith.constant 4 : u32; + v476 = arith.mod v474, v878 : u32; + hir.assertz v476 #[code = 250]; + v477 = hir.int_to_ptr v474 : ptr; + hir.store v477, v473; + v478 = arith.mul v454, v440 : i32 #[overflow = wrapping]; + scf.yield v478; }; - scf.yield v971; + v479 = arith.constant 8 : i32; + v877 = arith.constant 4 : i32; + v873 = cf.select v460, v877, v479 : i32; + scf.yield v873, v872; }; - v607 = arith.constant 4 : u32; - v606 = hir.bitcast v590 : u32; - v608 = arith.add v606, v607 : u32 #[overflow = checked]; - v974 = arith.constant 4 : u32; - v610 = arith.mod v608, v974 : u32; - hir.assertz v610 #[code = 250]; - v611 = hir.int_to_ptr v608 : ptr; - hir.store v611, v592; - v613 = hir.bitcast v590 : u32; - v973 = arith.constant 4 : u32; - v615 = arith.mod v613, v973 : u32; - hir.assertz v615 #[code = 250]; - v616 = hir.int_to_ptr v613 : ptr; - hir.store v616, v972; + v482 = arith.add v437, v874 : i32 #[overflow = wrapping]; + v484 = hir.bitcast v482 : u32; + v876 = arith.constant 4 : u32; + v486 = arith.mod v484, v876 : u32; + hir.assertz v486 #[code = 250]; + v487 = hir.int_to_ptr v484 : ptr; + hir.store v487, v875; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v617: i32, v618: i32, v619: i32, v620: i32) { - ^block78(v617: i32, v618: i32, v619: i32, v620: i32): - v1002 = arith.constant 0 : i32; - v621 = arith.constant 0 : i32; - v625 = arith.eq v620, v621 : i1; - v626 = arith.zext v625 : u32; - v627 = hir.bitcast v626 : i32; - v629 = arith.neq v627, v1002 : i1; - v989, v990 = scf.if v629 : i32, i32 { - ^block148: - v1001 = arith.constant 0 : i32; - v623 = arith.constant 4 : i32; - scf.yield v623, v1001; + private builtin.function @::deallocate(v488: i32, v489: i32, v490: i32) { + ^block67(v488: i32, v489: i32, v490: i32): + v889 = arith.constant 0 : i32; + v491 = arith.constant 0 : i32; + v492 = arith.eq v490, v491 : i1; + v493 = arith.zext v492 : u32; + v494 = hir.bitcast v493 : i32; + v496 = arith.neq v494, v889 : i1; + scf.if v496{ + ^block69: + scf.yield ; } else { - ^block81: - v630 = hir.bitcast v618 : u32; - v665 = arith.constant 4 : u32; - v632 = arith.mod v630, v665 : u32; - hir.assertz v632 #[code = 250]; - v633 = hir.int_to_ptr v630 : ptr; - v634 = hir.load v633 : i32; - v999 = arith.constant 0 : i32; - v1000 = arith.constant 0 : i32; - v636 = arith.eq v634, v1000 : i1; - v637 = arith.zext v636 : u32; - v638 = hir.bitcast v637 : i32; - v640 = arith.neq v638, v999 : i1; - v987 = scf.if v640 : i32 { - ^block147: - v998 = arith.constant 0 : i32; - scf.yield v998; - } else { - ^block82: - v997 = arith.constant 4 : u32; - v641 = hir.bitcast v617 : u32; - v643 = arith.add v641, v997 : u32 #[overflow = checked]; - v996 = arith.constant 4 : u32; - v645 = arith.mod v643, v996 : u32; - hir.assertz v645 #[code = 250]; - v646 = hir.int_to_ptr v643 : ptr; - hir.store v646, v619; - v995 = arith.constant 4 : u32; - v647 = hir.bitcast v618 : u32; - v649 = arith.add v647, v995 : u32 #[overflow = checked]; - v994 = arith.constant 4 : u32; - v651 = arith.mod v649, v994 : u32; - hir.assertz v651 #[code = 250]; - v652 = hir.int_to_ptr v649 : ptr; - v653 = hir.load v652 : i32; - v654 = hir.bitcast v617 : u32; - v993 = arith.constant 4 : u32; - v656 = arith.mod v654, v993 : u32; - hir.assertz v656 #[code = 250]; - v657 = hir.int_to_ptr v654 : ptr; - hir.store v657, v653; - v658 = arith.mul v634, v620 : i32 #[overflow = wrapping]; - scf.yield v658; - }; - v659 = arith.constant 8 : i32; - v992 = arith.constant 4 : i32; - v988 = cf.select v640, v992, v659 : i32; - scf.yield v988, v987; + ^block70: + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v488, v490, v489) + scf.yield ; }; - v662 = arith.add v617, v989 : i32 #[overflow = wrapping]; - v664 = hir.bitcast v662 : u32; - v991 = arith.constant 4 : u32; - v666 = arith.mod v664, v991 : u32; - hir.assertz v666 #[code = 250]; - v667 = hir.int_to_ptr v664 : ptr; - hir.store v667, v990; builtin.ret ; }; - private builtin.function @::deallocate(v668: i32, v669: i32, v670: i32) { - ^block83(v668: i32, v669: i32, v670: i32): - v1004 = arith.constant 0 : i32; - v671 = arith.constant 0 : i32; - v672 = arith.eq v670, v671 : i1; - v673 = arith.zext v672 : u32; - v674 = hir.bitcast v673 : i32; - v676 = arith.neq v674, v1004 : i1; - scf.if v676{ - ^block85: - scf.yield ; + private builtin.function @::allocate(v497: i32, v498: i32, v499: i32) { + ^block71(v497: i32, v498: i32, v499: i32): + v501 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v502 = hir.bitcast v501 : ptr; + v503 = hir.load v502 : i32; + v504 = arith.constant 16 : i32; + v505 = arith.sub v503, v504 : i32 #[overflow = wrapping]; + v506 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v507 = hir.bitcast v506 : ptr; + hir.store v507, v505; + v500 = arith.constant 0 : i32; + v508 = arith.constant 8 : i32; + v509 = arith.add v505, v508 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc_impl(v509, v498, v499, v500) + v512 = arith.constant 12 : u32; + v511 = hir.bitcast v505 : u32; + v513 = arith.add v511, v512 : u32 #[overflow = checked]; + v514 = arith.constant 4 : u32; + v515 = arith.mod v513, v514 : u32; + hir.assertz v515 #[code = 250]; + v516 = hir.int_to_ptr v513 : ptr; + v517 = hir.load v516 : i32; + v519 = arith.constant 8 : u32; + v518 = hir.bitcast v505 : u32; + v520 = arith.add v518, v519 : u32 #[overflow = checked]; + v894 = arith.constant 4 : u32; + v522 = arith.mod v520, v894 : u32; + hir.assertz v522 #[code = 250]; + v523 = hir.int_to_ptr v520 : ptr; + v524 = hir.load v523 : i32; + v525 = hir.bitcast v497 : u32; + v893 = arith.constant 4 : u32; + v527 = arith.mod v525, v893 : u32; + hir.assertz v527 #[code = 250]; + v528 = hir.int_to_ptr v525 : ptr; + hir.store v528, v524; + v892 = arith.constant 4 : u32; + v529 = hir.bitcast v497 : u32; + v531 = arith.add v529, v892 : u32 #[overflow = checked]; + v891 = arith.constant 4 : u32; + v533 = arith.mod v531, v891 : u32; + hir.assertz v533 #[code = 250]; + v534 = hir.int_to_ptr v531 : ptr; + hir.store v534, v517; + v890 = arith.constant 16 : i32; + v536 = arith.add v505, v890 : i32 #[overflow = wrapping]; + v537 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v538 = hir.bitcast v537 : ptr; + hir.store v538, v536; + builtin.ret ; + }; + + private builtin.function @::try_allocate_in(v539: i32, v540: i32, v541: i32, v542: i32, v543: i32) { + ^block73(v539: i32, v540: i32, v541: i32, v542: i32, v543: i32): + v546 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v547 = hir.bitcast v546 : ptr; + v548 = hir.load v547 : i32; + v549 = arith.constant 16 : i32; + v550 = arith.sub v548, v549 : i32 #[overflow = wrapping]; + v551 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v552 = hir.bitcast v551 : ptr; + hir.store v552, v550; + v562 = hir.bitcast v540 : u32; + v563 = arith.zext v562 : u64; + v564 = hir.bitcast v563 : i64; + v544 = arith.constant 0 : i32; + v557 = arith.sub v544, v542 : i32 #[overflow = wrapping]; + v554 = arith.constant -1 : i32; + v553 = arith.add v542, v543 : i32 #[overflow = wrapping]; + v555 = arith.add v553, v554 : i32 #[overflow = wrapping]; + v558 = arith.band v555, v557 : i32; + v559 = hir.bitcast v558 : u32; + v560 = arith.zext v559 : u64; + v561 = hir.bitcast v560 : i64; + v565 = arith.mul v561, v564 : i64 #[overflow = wrapping]; + v997 = arith.constant 0 : i32; + v566 = arith.constant 32 : i64; + v568 = hir.cast v566 : u32; + v567 = hir.bitcast v565 : u64; + v569 = arith.shr v567, v568 : u64; + v570 = hir.bitcast v569 : i64; + v571 = arith.trunc v570 : i32; + v573 = arith.neq v571, v997 : i1; + v910, v911, v912, v913, v914, v915 = scf.if v573 : i32, i32, i32, i32, i32, u32 { + ^block145: + v895 = arith.constant 0 : u32; + v902 = ub.poison i32 : i32; + scf.yield v539, v550, v902, v902, v902, v895; } else { - ^block86: - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v668, v670, v669) - scf.yield ; + ^block78: + v574 = arith.trunc v565 : i32; + v996 = arith.constant 0 : i32; + v575 = arith.constant -2147483648 : i32; + v576 = arith.sub v575, v542 : i32 #[overflow = wrapping]; + v578 = hir.bitcast v576 : u32; + v577 = hir.bitcast v574 : u32; + v579 = arith.lte v577, v578 : i1; + v580 = arith.zext v579 : u32; + v581 = hir.bitcast v580 : i32; + v583 = arith.neq v581, v996 : i1; + v958 = scf.if v583 : i32 { + ^block76: + v995 = arith.constant 0 : i32; + v594 = arith.neq v574, v995 : i1; + v957 = scf.if v594 : i32 { + ^block80: + v994 = arith.constant 0 : i32; + v610 = arith.neq v541, v994 : i1; + v956 = scf.if v610 : i32 { + ^block83: + v592 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc_impl(v550, v542, v574, v592) + v621 = hir.bitcast v550 : u32; + v662 = arith.constant 4 : u32; + v623 = arith.mod v621, v662 : u32; + hir.assertz v623 #[code = 250]; + v624 = hir.int_to_ptr v621 : ptr; + v625 = hir.load v624 : i32; + scf.yield v625; + } else { + ^block84: + v611 = arith.constant 8 : i32; + v612 = arith.add v550, v611 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v612, v542, v574) + v596 = arith.constant 8 : u32; + v613 = hir.bitcast v550 : u32; + v615 = arith.add v613, v596 : u32 #[overflow = checked]; + v993 = arith.constant 4 : u32; + v617 = arith.mod v615, v993 : u32; + hir.assertz v617 #[code = 250]; + v618 = hir.int_to_ptr v615 : ptr; + v619 = hir.load v618 : i32; + scf.yield v619; + }; + v992 = arith.constant 0 : i32; + v628 = arith.neq v956, v992 : i1; + scf.if v628{ + ^block85: + v991 = arith.constant 8 : u32; + v645 = hir.bitcast v539 : u32; + v647 = arith.add v645, v991 : u32 #[overflow = checked]; + v990 = arith.constant 4 : u32; + v649 = arith.mod v647, v990 : u32; + hir.assertz v649 #[code = 250]; + v650 = hir.int_to_ptr v647 : ptr; + hir.store v650, v956; + v989 = arith.constant 4 : u32; + v652 = hir.bitcast v539 : u32; + v654 = arith.add v652, v989 : u32 #[overflow = checked]; + v988 = arith.constant 4 : u32; + v656 = arith.mod v654, v988 : u32; + hir.assertz v656 #[code = 250]; + v657 = hir.int_to_ptr v654 : ptr; + hir.store v657, v540; + scf.yield ; + } else { + ^block86: + v987 = arith.constant 8 : u32; + v631 = hir.bitcast v539 : u32; + v633 = arith.add v631, v987 : u32 #[overflow = checked]; + v986 = arith.constant 4 : u32; + v635 = arith.mod v633, v986 : u32; + hir.assertz v635 #[code = 250]; + v636 = hir.int_to_ptr v633 : ptr; + hir.store v636, v574; + v985 = arith.constant 4 : u32; + v638 = hir.bitcast v539 : u32; + v640 = arith.add v638, v985 : u32 #[overflow = checked]; + v984 = arith.constant 4 : u32; + v642 = arith.mod v640, v984 : u32; + hir.assertz v642 #[code = 250]; + v643 = hir.int_to_ptr v640 : ptr; + hir.store v643, v542; + scf.yield ; + }; + v982 = arith.constant 1 : i32; + v983 = arith.constant 0 : i32; + v955 = cf.select v628, v983, v982 : i32; + scf.yield v955; + } else { + ^block81: + v981 = arith.constant 8 : u32; + v595 = hir.bitcast v539 : u32; + v597 = arith.add v595, v981 : u32 #[overflow = checked]; + v980 = arith.constant 4 : u32; + v599 = arith.mod v597, v980 : u32; + hir.assertz v599 #[code = 250]; + v600 = hir.int_to_ptr v597 : ptr; + hir.store v600, v542; + v979 = arith.constant 4 : u32; + v603 = hir.bitcast v539 : u32; + v605 = arith.add v603, v979 : u32 #[overflow = checked]; + v978 = arith.constant 4 : u32; + v607 = arith.mod v605, v978 : u32; + hir.assertz v607 #[code = 250]; + v977 = arith.constant 0 : i32; + v608 = hir.int_to_ptr v605 : ptr; + hir.store v608, v977; + v976 = arith.constant 0 : i32; + scf.yield v976; + }; + scf.yield v957; + } else { + ^block79: + v975 = ub.poison i32 : i32; + scf.yield v975; + }; + v970 = arith.constant 0 : u32; + v903 = arith.constant 1 : u32; + v963 = cf.select v583, v903, v970 : u32; + v971 = ub.poison i32 : i32; + v962 = cf.select v583, v550, v971 : i32; + v972 = ub.poison i32 : i32; + v961 = cf.select v583, v539, v972 : i32; + v973 = ub.poison i32 : i32; + v960 = cf.select v583, v973, v550 : i32; + v974 = ub.poison i32 : i32; + v959 = cf.select v583, v974, v539 : i32; + scf.yield v959, v960, v961, v958, v962, v963; + }; + v916, v917, v918 = scf.index_switch v915 : i32, i32, i32 + case 0 { + ^block77: + v969 = arith.constant 4 : u32; + v586 = hir.bitcast v910 : u32; + v588 = arith.add v586, v969 : u32 #[overflow = checked]; + v968 = arith.constant 4 : u32; + v590 = arith.mod v588, v968 : u32; + hir.assertz v590 #[code = 250]; + v967 = arith.constant 0 : i32; + v591 = hir.int_to_ptr v588 : ptr; + hir.store v591, v967; + v966 = arith.constant 1 : i32; + scf.yield v910, v966, v911; + } + default { + ^block149: + scf.yield v912, v913, v914; }; + v661 = hir.bitcast v916 : u32; + v965 = arith.constant 4 : u32; + v663 = arith.mod v661, v965 : u32; + hir.assertz v663 #[code = 250]; + v664 = hir.int_to_ptr v661 : ptr; + hir.store v664, v917; + v964 = arith.constant 16 : i32; + v669 = arith.add v918, v964 : i32 #[overflow = wrapping]; + v670 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v671 = hir.bitcast v670 : ptr; + hir.store v671, v669; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v677: i32, v678: i32, v679: i32) { - ^block87(v677: i32, v678: i32, v679: i32): + private builtin.function @alloc::raw_vec::handle_error(v672: i32, v673: i32) { + ^block87(v672: i32, v673: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v680: i32, v681: i32) -> i32 { - ^block89(v680: i32, v681: i32): - v688 = arith.constant 0 : i32; - v684 = hir.bitcast v681 : u32; - v683 = hir.bitcast v680 : u32; - v685 = arith.gt v683, v684 : i1; - v686 = arith.zext v685 : u32; - v687 = hir.bitcast v686 : i32; - v689 = arith.neq v687, v688 : i1; - v690 = cf.select v689, v680, v681 : i32; - builtin.ret v690; + private builtin.function @::max(v674: i32, v675: i32) -> i32 { + ^block89(v674: i32, v675: i32): + v682 = arith.constant 0 : i32; + v678 = hir.bitcast v675 : u32; + v677 = hir.bitcast v674 : u32; + v679 = arith.gt v677, v678 : i1; + v680 = arith.zext v679 : u32; + v681 = hir.bitcast v680 : i32; + v683 = arith.neq v681, v682 : i1; + v684 = cf.select v683, v674, v675 : i32; + builtin.ret v684; }; - private builtin.function @miden::active_note::get_inputs(v691: i32) -> i32 { - ^block91(v691: i32): - v692, v693 = hir.exec @miden/active_note/get_inputs(v691) : i32, i32 - builtin.ret v692; + private builtin.function @miden::active_note::get_inputs(v685: i32) -> i32 { + ^block91(v685: i32): + v686, v687 = hir.exec @miden/active_note/get_inputs(v685) : i32, i32 + builtin.ret v686; }; - public builtin.function @cabi_realloc(v695: i32, v696: i32, v697: i32, v698: i32) -> i32 { - ^block95(v695: i32, v696: i32, v697: i32, v698: i32): - v700 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/cabi_realloc_wit_bindgen_0_46_0(v695, v696, v697, v698) : i32 - builtin.ret v700; + public builtin.function @cabi_realloc(v689: i32, v690: i32, v691: i32, v692: i32) -> i32 { + ^block95(v689: i32, v690: i32, v691: i32, v692: i32): + v694 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/cabi_realloc_wit_bindgen_0_46_0(v689, v690, v691, v692) : i32 + builtin.ret v694; }; - private builtin.function @alloc::alloc::alloc(v701: i32, v702: i32) -> i32 { - ^block97(v701: i32, v702: i32): + private builtin.function @alloc::alloc::alloc(v695: i32, v696: i32) -> i32 { + ^block97(v695: i32, v696: i32): hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v704 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v702, v701) : i32 - builtin.ret v704; - }; - - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v705: i32, v706: i32, v707: i32, v708: i32) -> i32 { - ^block99(v705: i32, v706: i32, v707: i32, v708: i32): - v710 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/wit_bindgen::rt::cabi_realloc(v705, v706, v707, v708) : i32 - builtin.ret v710; + v698 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v696, v695) : i32 + builtin.ret v698; }; - private builtin.function @wit_bindgen::rt::cabi_realloc(v711: i32, v712: i32, v713: i32, v714: i32) -> i32 { - ^block101(v711: i32, v712: i32, v713: i32, v714: i32): - v716 = arith.constant 0 : i32; - v717 = arith.neq v712, v716 : i1; - v1015, v1016, v1017 = scf.if v717 : i32, i32, u32 { - ^block105: - v725 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_realloc(v711, v712, v713, v714) : i32 - v1006 = arith.constant 0 : u32; - v1010 = ub.poison i32 : i32; - scf.yield v725, v1010, v1006; + private builtin.function @wit_bindgen::rt::cabi_realloc(v699: i32, v700: i32, v701: i32, v702: i32) -> i32 { + ^block99(v699: i32, v700: i32, v701: i32, v702: i32): + v704 = arith.constant 0 : i32; + v705 = arith.neq v700, v704 : i1; + v1008, v1009, v1010 = scf.if v705 : i32, i32, u32 { + ^block103: + v713 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_realloc(v699, v700, v701, v702) : i32 + v999 = arith.constant 0 : u32; + v1003 = ub.poison i32 : i32; + scf.yield v713, v1003, v999; } else { - ^block106: - v1045 = arith.constant 0 : i32; - v1046 = arith.constant 0 : i32; - v719 = arith.eq v714, v1046 : i1; - v720 = arith.zext v719 : u32; - v721 = hir.bitcast v720 : i32; - v723 = arith.neq v721, v1045 : i1; - v1033 = scf.if v723 : i32 { + ^block104: + v1038 = arith.constant 0 : i32; + v1039 = arith.constant 0 : i32; + v707 = arith.eq v702, v1039 : i1; + v708 = arith.zext v707 : u32; + v709 = hir.bitcast v708 : i32; + v711 = arith.neq v709, v1038 : i1; + v1026 = scf.if v711 : i32 { ^block152: - v1044 = ub.poison i32 : i32; - scf.yield v1044; + v1037 = ub.poison i32 : i32; + scf.yield v1037; } else { - ^block107: - v724 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::alloc(v713, v714) : i32 - scf.yield v724; + ^block105: + v712 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::alloc(v701, v702) : i32 + scf.yield v712; }; - v1042 = arith.constant 0 : u32; - v1011 = arith.constant 1 : u32; - v1035 = cf.select v723, v1011, v1042 : u32; - v1043 = ub.poison i32 : i32; - v1034 = cf.select v723, v713, v1043 : i32; - scf.yield v1033, v1034, v1035; + v1035 = arith.constant 0 : u32; + v1004 = arith.constant 1 : u32; + v1028 = cf.select v711, v1004, v1035 : u32; + v1036 = ub.poison i32 : i32; + v1027 = cf.select v711, v701, v1036 : i32; + scf.yield v1026, v1027, v1028; }; - v1022, v1023 = scf.index_switch v1017 : i32, u32 + v1015, v1016 = scf.index_switch v1010 : i32, u32 case 0 { - ^block104: - v1040 = arith.constant 0 : i32; - v728 = arith.neq v1015, v1040 : i1; - v1037 = arith.constant 1 : u32; - v1038 = arith.constant 0 : u32; - v1032 = cf.select v728, v1038, v1037 : u32; - v1039 = ub.poison i32 : i32; - v1031 = cf.select v728, v1015, v1039 : i32; - scf.yield v1031, v1032; + ^block102: + v1033 = arith.constant 0 : i32; + v716 = arith.neq v1008, v1033 : i1; + v1030 = arith.constant 1 : u32; + v1031 = arith.constant 0 : u32; + v1025 = cf.select v716, v1031, v1030 : u32; + v1032 = ub.poison i32 : i32; + v1024 = cf.select v716, v1008, v1032 : i32; + scf.yield v1024, v1025; } default { ^block159: - v1041 = arith.constant 0 : u32; - scf.yield v1016, v1041; + v1034 = arith.constant 0 : u32; + scf.yield v1009, v1034; }; - v1036 = arith.constant 0 : u32; - v1030 = arith.eq v1023, v1036 : i1; - cf.cond_br v1030 ^block154, ^block155; + v1029 = arith.constant 0 : u32; + v1023 = arith.eq v1016, v1029 : i1; + cf.cond_br v1023 ^block154, ^block155; ^block154: - builtin.ret v1022; + builtin.ret v1015; ^block155: ub.unreachable ; }; + public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v718: i32, v719: i32, v720: i32, v721: i32) -> i32 { + ^block107(v718: i32, v719: i32, v720: i32, v721: i32): + v723 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/wit_bindgen::rt::cabi_realloc(v718, v719, v720, v721) : i32 + builtin.ret v723; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x0000000100000000000000000000000a0010000000003e64657463616465723c; + 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 index dac677b53..d8cdc4ff4 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm @@ -5,10 +5,10 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[13303268137284580667,14000914427208839465,16230032807968224336,7923152364088757166] + push.[381941261429277531,4212401613039242911,15832969995826621848,144075553990749275] adv.push_mapval push.262144 - push.2 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 @@ -20,6 +20,205 @@ 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( @@ -270,7 +469,7 @@ pub proc entrypoint( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::raw_vec::RawVecInner::deallocate + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::deallocate trace.252 nop push.16 @@ -303,247 +502,48 @@ pub proc entrypoint( end @callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048608 - 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 +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( -@callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop +) + nop end @callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048608 +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 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 + u32gt + neq + dup.3 + swap.1 + cdrop push.0 + push.4294967295 dup.2 - eq + u32wrapping_add + dup.2 + u32and neq if.true - movdn.3 - drop - drop - drop + 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 - 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.1048608 - 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") -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::core::ptr::alignment::Alignment::max - trace.252 - nop - push.0 - push.2147483648 + push.2147483648 dup.2 u32wrapping_sub dup.4 @@ -700,7 +700,7 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc alloc::raw_vec::RawVecInner::with_capacity_in( +proc ::with_capacity_in( i32, i32, i32 @@ -738,7 +738,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( movdn.3 trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::raw_vec::RawVecInner::try_allocate_in + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::try_allocate_in trace.252 nop push.8 @@ -859,8 +859,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048588 - swap.2 + swap.1 trace.240 nop exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::raw_vec::handle_error @@ -904,7 +903,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::raw_vec::RawVecInner::with_capacity_in + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::with_capacity_in trace.252 nop push.8 @@ -1018,22 +1017,100 @@ proc >::fro end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +proc ::alloc_impl( + i32, i32, i32, i32 ) - push.1114144 + 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 @@ -1063,7 +1140,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::raw_vec::RawVecInner::current_memory + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::current_memory trace.252 nop push.8 @@ -1145,9 +1222,165 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( +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 @@ -1172,52 +1405,173 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( 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 + push.8 + dup.2 u32wrapping_add - u32and - push.0 + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 trace.240 nop - exec.::intrinsics::i64::wrapping_mul + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::alloc_impl trace.252 nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 dup.3 - movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::std::math::u64::shr + exec.::intrinsics::mem::load_sw trace.252 nop - drop - neq - if.true - drop - drop - movup.2 - drop - movup.2 + 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 @@ -1256,7 +1610,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::alloc::Global::alloc_impl + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::alloc_impl trace.252 nop dup.2 @@ -1304,14 +1658,12 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop end push.0 - push.0 - dup.2 - eq + dup.1 neq dup.0 if.true - movup.6 - movup.2 + movup.7 + movup.4 drop drop push.8 @@ -1324,7 +1676,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.3 + movup.2 swap.1 u32divmod.4 swap.1 @@ -1353,8 +1705,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop else - movup.7 - movup.4 + movup.6 + movup.2 drop drop push.8 @@ -1367,7 +1719,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.2 + movup.3 swap.1 u32divmod.4 swap.1 @@ -1396,8 +1748,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop end - push.0 push.1 + push.0 movup.2 cdrop else @@ -1449,428 +1801,89 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( 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 ::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::alloc::Global::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 alloc::alloc::Global::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 + swap.3 + swap.2 + swap.1 + end 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 + 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 - 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 alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq + movup.5 + eq.0 if.true - movdn.3 + movup.2 drop + movup.2 drop + movup.2 drop - push.0 push.4 - else 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::load_sw + exec.::intrinsics::mem::store_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 + push.1 + swap.1 + else + drop + drop end - movup.2 - u32wrapping_add push.4 dup.1 swap.1 @@ -1884,37 +1897,20 @@ proc alloc::raw_vec::RawVecInner::current_memory( 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 ::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 alloc::raw_vec::handle_error(i32, i32, i32) - drop +proc alloc::raw_vec::handle_error(i32, i32) drop drop push.0 @@ -1922,7 +1918,10 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) end @callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 +proc ::max( + i32, + i32 +) -> i32 push.0 dup.2 dup.2 @@ -1967,15 +1966,6 @@ proc alloc::alloc::alloc(i32, i32) -> i32 nop 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 - @callconv("C") proc wit_bindgen::rt::cabi_realloc( i32, @@ -2063,6 +2053,15 @@ proc wit_bindgen::rt::cabi_realloc( 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 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 index 8191e94d9..89860b410 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat @@ -1,16 +1,17 @@ (module $abi_transform_tx_kernel_get_inputs_4.wasm - (type (;0;) (func)) - (type (;1;) (func (param i32 i32) (result i32))) - (type (;2;) (func (param i32 i32 i32))) - (type (;3;) (func (param i32 i32 i32 i32) (result i32))) + (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 i32))) - (type (;10;) (func (param i32 i32 i32 i32))) - (type (;11;) (func (param i32) (result i32))) + (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) @@ -19,7 +20,58 @@ (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 $entrypoint (;0;) (type 0) + (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 @@ -80,7 +132,7 @@ i32.add i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 0 i32.const 16 i32.add @@ -89,58 +141,7 @@ end unreachable ) - (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) - i32.const 1048608 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) - (func $__rustc::__rust_realloc (;3;) (type 3) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - i32.const 1048608 - 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 (;4;) (type 1) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048608 - 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 $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;5;) (type 0) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;5;) (type 3) return ) (func $::alloc (;6;) (type 4) (param i32 i32 i32) (result i32) @@ -162,7 +163,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -218,7 +219,7 @@ (func $intrinsics::mem::heap_base (;7;) (type 5) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;8;) (type 2) (param i32 i32 i32) + (func $::with_capacity_in (;8;) (type 1) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -232,7 +233,7 @@ i32.const 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::try_allocate_in + call $::try_allocate_in local.get 3 i32.load offset=8 local.set 2 @@ -245,7 +246,6 @@ local.get 2 local.get 3 i32.load offset=12 - i32.const 1048588 call $alloc::raw_vec::handle_error unreachable end @@ -273,7 +273,7 @@ i32.add i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::with_capacity_in + call $::with_capacity_in local.get 1 i32.load offset=8 local.set 2 @@ -300,13 +300,40 @@ local.get 0 f32.reinterpret_i32 ) - (func $intrinsics::felt::from_u32 (;11;) (type 7) (param i32) (result f32) + (func $intrinsics::felt::assert_eq (;11;) (type 8) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;12;) (type 8) (param f32 f32) + (func $intrinsics::felt::from_u32 (;12;) (type 7) (param i32) (result f32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 2) (param i32 i32 i32) + (func $::alloc_impl (;13;) (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 (;14;) (type 1) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -319,7 +346,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -338,7 +365,82 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;14;) (type 9) (param i32 i32 i32 i32 i32) + (func $::current_memory (;15;) (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 (;16;) (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 (;17;) (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 (;18;) (type 10) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -414,32 +516,31 @@ local.get 3 local.get 4 i32.const 1 - call $alloc::alloc::Global::alloc_impl + call $::alloc_impl local.get 5 i32.load local.set 2 end block ;; label = @2 local.get 2 - i32.eqz br_if 0 (;@2;) local.get 0 - local.get 2 + local.get 4 i32.store offset=8 local.get 0 - local.get 1 + local.get 3 i32.store offset=4 - i32.const 0 + i32.const 1 local.set 3 br 1 (;@1;) end local.get 0 - local.get 4 + local.get 2 i32.store offset=8 local.get 0 - local.get 3 + local.get 1 i32.store offset=4 - i32.const 1 + i32.const 0 local.set 3 end local.get 0 @@ -450,112 +551,10 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;15;) (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::alloc::Global::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 $alloc::alloc::Global::alloc_impl (;16;) (type 10) (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 $alloc::raw_vec::RawVecInner::current_memory (;17;) (type 10) (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 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 $alloc::raw_vec::handle_error (;19;) (type 2) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;19;) (type 11) (param i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;20;) (type 1) (param i32 i32) (result i32) + (func $::max (;20;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -563,30 +562,23 @@ i32.gt_u select ) - (func $miden::active_note::get_inputs (;21;) (type 11) (param i32) (result i32) + (func $miden::active_note::get_inputs (;21;) (type 12) (param i32) (result i32) unreachable ) - (func $cabi_realloc (;22;) (type 3) (param i32 i32 i32 i32) (result i32) + (func $cabi_realloc (;22;) (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 (;23;) (type 1) (param i32 i32) (result i32) + (func $alloc::alloc::alloc (;23;) (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 $cabi_realloc_wit_bindgen_0_46_0 (;24;) (type 3) (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 - ) - (func $wit_bindgen::rt::cabi_realloc (;25;) (type 3) (param i32 i32 i32 i32) (result i32) + (func $wit_bindgen::rt::cabi_realloc (;24;) (type 2) (param i32 i32 i32 i32) (result i32) block ;; label = @1 block ;; label = @2 block ;; label = @3 @@ -614,5 +606,12 @@ end local.get 2 ) - (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00") + (func $cabi_realloc_wit_bindgen_0_46_0 (;25;) (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/adv_load_preimage.hir b/tests/integration/expected/adv_load_preimage.hir index b8867153b..19d4c66d9 100644 --- a/tests/integration/expected/adv_load_preimage.hir +++ b/tests/integration/expected/adv_load_preimage.hir @@ -1,750 +1,743 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @adv_load_preimage { - public builtin.function @entrypoint(v0: i32, v1: felt, v2: felt, v3: felt, v4: felt) { - ^block4(v0: i32, v1: felt, v2: felt, v3: felt, v4: felt): - v9 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v10 = hir.bitcast v9 : ptr; - v11 = hir.load v10 : i32; - v12 = arith.constant 16 : i32; - v13 = arith.sub v11, v12 : i32 #[overflow = wrapping]; - v14 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v15 = hir.bitcast v14 : ptr; - hir.store v15, v13; - v16 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::advice::adv_push_mapvaln(v4, v3, v2, v1) : felt - v17 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::as_u64(v16) : i64 - v19 = arith.constant 3 : i32; - v18 = arith.trunc v17 : i32; - v20 = arith.band v18, v19 : i32; - v21 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v20) : felt - v5 = arith.constant 0 : i32; - v23 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v5) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v21, v23) - v26 = arith.constant 2 : i64; - v28 = hir.cast v26 : u32; - v27 = hir.bitcast v17 : u64; - v29 = arith.shr v27, v28 : u64; - v30 = hir.bitcast v29 : i64; - v31 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u64_unchecked(v30) : felt - v32 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::as_u64(v31) : i64 - v515 = arith.constant 2 : u32; - v33 = arith.trunc v32 : i32; - v36 = arith.shl v33, v515 : i32; - v556 = arith.constant 4 : i32; - v557 = arith.constant 0 : i32; - v24 = arith.constant 4 : i32; - v25 = arith.add v13, v24 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::RawVecInner::try_allocate_in(v25, v36, v557, v556, v556) - v41 = arith.constant 8 : u32; - v40 = hir.bitcast v13 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; - v43 = arith.constant 4 : u32; - v44 = arith.mod v42, v43 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : i32; - v555 = arith.constant 4 : u32; - v47 = hir.bitcast v13 : u32; - v49 = arith.add v47, v555 : u32 #[overflow = checked]; - v554 = arith.constant 4 : u32; - v51 = arith.mod v49, v554 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - v53 = hir.load v52 : i32; - v553 = arith.constant 0 : i32; - v54 = arith.constant 1 : i32; - v55 = arith.eq v53, v54 : i1; - v56 = arith.zext v55 : u32; - v57 = hir.bitcast v56 : i32; - v59 = arith.neq v57, v553 : i1; - v520 = scf.if v59 : u32 { - ^block7: - v150 = arith.constant 12 : u32; - v149 = hir.bitcast v13 : u32; - v151 = arith.add v149, v150 : u32 #[overflow = checked]; - v552 = arith.constant 4 : u32; - v153 = arith.mod v151, v552 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - v155 = hir.load v154 : i32; - v156 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v46, v155, v156) - v516 = arith.constant 0 : u32; - scf.yield v516; - } else { + 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; + }; + + 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: - v551 = arith.constant 12 : u32; - v60 = hir.bitcast v13 : u32; - v62 = arith.add v60, v551 : u32 #[overflow = checked]; + 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: + 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; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v9; + }; + + 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 { + ^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; + } 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; - v64 = arith.mod v62, v550 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - v66 = hir.load v65 : i32; - v549 = arith.constant 2 : u32; - v68 = hir.bitcast v66 : u32; - v70 = arith.shr v68, v549 : u32; - v71 = hir.bitcast v70 : i32; - v72 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/std::mem::pipe_preimage_to_memory(v31, v71, v4, v3, v2, v1) : i32 - v548 = arith.constant 8 : u32; - v73 = hir.bitcast v0 : u32; - v75 = arith.add v73, v548 : u32 #[overflow = checked]; + v105 = arith.mod v103, v550 : 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; - v77 = arith.mod v75, v547 : u32; - hir.assertz v77 #[code = 250]; - v78 = hir.int_to_ptr v75 : ptr; - hir.store v78, v36; - v546 = arith.constant 4 : u32; - v79 = hir.bitcast v0 : u32; - v81 = arith.add v79, v546 : u32 #[overflow = checked]; - v545 = arith.constant 4 : u32; - v83 = arith.mod v81, v545 : u32; - hir.assertz v83 #[code = 250]; - v84 = hir.int_to_ptr v81 : ptr; - hir.store v84, v66; - v85 = hir.bitcast v0 : u32; - v544 = arith.constant 4 : u32; - v87 = arith.mod v85, v544 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v46; - v542 = arith.constant 0 : i32; - v543 = arith.constant 0 : i32; - v90 = arith.eq v36, v543 : i1; - v91 = arith.zext v90 : u32; - v92 = hir.bitcast v91 : i32; - v94 = arith.neq v92, v542 : i1; - v522 = scf.if v94 : u32 { - ^block77: - v541 = arith.constant 0 : u32; - scf.yield v541; + 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; } else { - ^block9: - v95 = hir.bitcast v66 : u32; + ^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; - v97 = arith.mod v95, v540 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - v99 = hir.load v98 : felt; - v539 = arith.constant 1 : i32; - v101 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v539) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v99, v101) - v538 = arith.constant 4 : u32; - v102 = hir.bitcast v66 : u32; - v104 = arith.add v102, v538 : u32 #[overflow = checked]; - v537 = arith.constant 4 : u32; - v106 = arith.mod v104, v537 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : felt; - v34 = arith.constant 2 : i32; - v110 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v34) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v108, v110) - v536 = arith.constant 0 : i32; - v513 = arith.constant 5 : u32; - v112 = hir.bitcast v36 : u32; - v114 = arith.lte v112, v513 : i1; - v115 = arith.zext v114 : u32; - v116 = hir.bitcast v115 : i32; - v118 = arith.neq v116, v536 : i1; - v524 = scf.if v118 : u32 { - ^block76: - v535 = arith.constant 0 : u32; - scf.yield v535; + 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; } else { - ^block10: - v120 = arith.constant 20 : u32; - v119 = hir.bitcast v66 : u32; - v121 = arith.add v119, v120 : u32 #[overflow = checked]; - v534 = arith.constant 4 : u32; - v123 = arith.mod v121, v534 : u32; - hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : felt; - v126 = arith.constant 6 : i32; - v127 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v126) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v125, v127) - v533 = arith.constant 0 : i32; - v512 = arith.constant 14 : u32; - v129 = hir.bitcast v36 : u32; - v131 = arith.lte v129, v512 : i1; - v132 = arith.zext v131 : u32; - v133 = hir.bitcast v132 : i32; - v135 = arith.neq v133, v533 : i1; - scf.if v135{ - ^block75: + ^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: scf.yield ; } else { - ^block11: - v137 = arith.constant 56 : u32; - v136 = hir.bitcast v66 : u32; - v138 = arith.add v136, v137 : u32 #[overflow = checked]; - v532 = arith.constant 4 : u32; - v140 = arith.mod v138, v532 : u32; - hir.assertz v140 #[code = 250]; - v141 = hir.int_to_ptr v138 : ptr; - v142 = hir.load v141 : felt; - v143 = arith.constant 15 : i32; - v144 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v143) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v142, v144) - v531 = arith.constant 16 : i32; - v146 = arith.add v13, v531 : i32 #[overflow = wrapping]; - v147 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v148 = hir.bitcast v147 : ptr; - hir.store v148, v146; + ^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; scf.yield ; }; - v518 = arith.constant 1 : u32; - v530 = arith.constant 0 : u32; - v528 = cf.select v135, v530, v518 : u32; - scf.yield v528; + v521 = arith.constant 1 : u32; + v533 = arith.constant 0 : u32; + v531 = cf.select v163, v533, v521 : u32; + scf.yield v531; }; - scf.yield v524; + scf.yield v527; }; - scf.yield v522; + scf.yield v525; }; - v529 = arith.constant 0 : u32; - v527 = arith.eq v520, v529 : i1; - cf.cond_br v527 ^block6, ^block79; - ^block6: + v532 = arith.constant 0 : u32; + v530 = arith.eq v523, v532 : i1; + cf.cond_br v530 ^block13, ^block82; + ^block13: ub.unreachable ; - ^block79: + ^block82: builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc(v157: i32, v158: i32) -> i32 { - ^block12(v157: i32, v158: i32): - v160 = arith.constant 1048604 : i32; - v161 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v160, v158, v157) : i32 - builtin.ret v161; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v162: i32, v163: i32) -> i32 { - ^block14(v162: i32, v163: i32): - v165 = arith.constant 1048604 : i32; - v166 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v165, v163, v162) : i32 - v566 = arith.constant 0 : i32; - v167 = arith.constant 0 : i32; - v168 = arith.eq v166, v167 : i1; - v169 = arith.zext v168 : u32; - v170 = hir.bitcast v169 : i32; - v172 = arith.neq v170, v566 : i1; - scf.if v172{ - ^block16: - scf.yield ; - } else { - ^block17: - v564 = arith.constant 0 : i32; - v565 = arith.constant 0 : i32; - v174 = arith.eq v162, v565 : i1; - v175 = arith.zext v174 : u32; - v176 = hir.bitcast v175 : i32; - v178 = arith.neq v176, v564 : i1; - scf.if v178{ - ^block84: - scf.yield ; - } else { - ^block18: - v558 = arith.constant 0 : u8; - v181 = hir.bitcast v162 : u32; - v182 = hir.bitcast v166 : u32; - v183 = hir.int_to_ptr v182 : ptr; - hir.mem_set v183, v181, v558; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v166; - }; - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { ^block19: builtin.ret ; }; - private builtin.function @::alloc(v185: i32, v186: i32, v187: i32) -> i32 { - ^block21(v185: i32, v186: i32, v187: i32): - v190 = arith.constant 16 : i32; - v189 = arith.constant 0 : i32; - v568 = arith.constant 16 : u32; - v192 = hir.bitcast v186 : u32; - v194 = arith.gt v192, v568 : i1; - v195 = arith.zext v194 : u32; - v196 = hir.bitcast v195 : i32; - v198 = arith.neq v196, v189 : i1; - v199 = cf.select v198, v186, v190 : i32; - v608 = arith.constant 0 : i32; - v200 = arith.constant -1 : i32; - v201 = arith.add v199, v200 : i32 #[overflow = wrapping]; - v202 = arith.band v199, v201 : i32; - v204 = arith.neq v202, v608 : i1; - v577, v578 = scf.if v204 : i32, u32 { + 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: - v569 = arith.constant 0 : u32; - v573 = ub.poison i32 : i32; - scf.yield v573, v569; + v563 = arith.constant 0 : u32; + v567 = ub.poison i32 : i32; + scf.yield v567, v563; } else { ^block24: - v206 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/core::ptr::alignment::Alignment::max(v186, v199) : i32 - v607 = arith.constant 0 : i32; - v205 = arith.constant -2147483648 : i32; - v207 = arith.sub v205, v206 : i32 #[overflow = wrapping]; - v209 = hir.bitcast v207 : u32; - v208 = hir.bitcast v187 : u32; - v210 = arith.gt v208, v209 : i1; - v211 = arith.zext v210 : u32; - v212 = hir.bitcast v211 : i32; - v214 = arith.neq v212, v607 : i1; - v592 = scf.if v214 : i32 { + 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: - v606 = ub.poison i32 : i32; - scf.yield v606; + v600 = ub.poison i32 : i32; + scf.yield v600; } else { ^block25: - v604 = arith.constant 0 : i32; - v220 = arith.sub v604, v206 : i32 #[overflow = wrapping]; - v605 = arith.constant -1 : i32; - v216 = arith.add v187, v206 : i32 #[overflow = wrapping]; - v218 = arith.add v216, v605 : i32 #[overflow = wrapping]; - v221 = arith.band v218, v220 : i32; - v222 = hir.bitcast v185 : u32; - v223 = arith.constant 4 : u32; - v224 = arith.mod v222, v223 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : i32; - v603 = arith.constant 0 : i32; - v228 = arith.neq v226, v603 : i1; - scf.if v228{ + 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: scf.yield ; } else { ^block27: - v229 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::mem::heap_base() : i32 - v230 = hir.mem_size : u32; - v236 = hir.bitcast v185 : u32; - v602 = arith.constant 4 : u32; - v238 = arith.mod v236, v602 : u32; - hir.assertz v238 #[code = 250]; - v601 = arith.constant 16 : u32; - v231 = hir.bitcast v230 : i32; - v234 = arith.shl v231, v601 : i32; - v235 = arith.add v229, v234 : i32 #[overflow = wrapping]; - v239 = hir.int_to_ptr v236 : ptr; - hir.store v239, v235; + 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; scf.yield ; }; - v242 = hir.bitcast v185 : u32; - v600 = arith.constant 4 : u32; - v244 = arith.mod v242, v600 : u32; - hir.assertz v244 #[code = 250]; - v245 = hir.int_to_ptr v242 : ptr; - v246 = hir.load v245 : i32; - v598 = arith.constant 0 : i32; - v599 = arith.constant -1 : i32; - v248 = arith.bxor v246, v599 : i32; - v250 = hir.bitcast v248 : u32; - v249 = hir.bitcast v221 : u32; - v251 = arith.gt v249, v250 : i1; - v252 = arith.zext v251 : u32; - v253 = hir.bitcast v252 : i32; - v255 = arith.neq v253, v598 : i1; - v591 = scf.if v255 : i32 { + 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: - v597 = arith.constant 0 : i32; - scf.yield v597; + v591 = arith.constant 0 : i32; + scf.yield v591; } else { ^block29: - v257 = hir.bitcast v185 : u32; - v596 = arith.constant 4 : u32; - v259 = arith.mod v257, v596 : u32; - hir.assertz v259 #[code = 250]; - v256 = arith.add v246, v221 : i32 #[overflow = wrapping]; - v260 = hir.int_to_ptr v257 : ptr; - hir.store v260, v256; - v262 = arith.add v246, v206 : i32 #[overflow = wrapping]; - scf.yield v262; + 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; }; - scf.yield v591; + scf.yield v585; }; - v574 = arith.constant 1 : u32; - v595 = arith.constant 0 : u32; - v593 = cf.select v214, v595, v574 : u32; - scf.yield v592, v593; + v568 = arith.constant 1 : u32; + v589 = arith.constant 0 : u32; + v587 = cf.select v213, v589, v568 : u32; + scf.yield v586, v587; }; - v594 = arith.constant 0 : u32; - v590 = arith.eq v578, v594 : i1; - cf.cond_br v590 ^block23, ^block91(v577); + v588 = arith.constant 0 : u32; + v584 = arith.eq v572, v588 : i1; + cf.cond_br v584 ^block23, ^block91(v571); ^block23: ub.unreachable ; - ^block91(v570: i32): - builtin.ret v570; + ^block91(v564: i32): + builtin.ret v564; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block30: - v265 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v265; + v264 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v264; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v267: i64) -> felt { - ^block34(v267: i64): - v268 = hir.cast v267 : felt; - builtin.ret v268; + 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::felt::from_u32(v270: i32) -> felt { - ^block36(v270: i32): - v271 = hir.bitcast v270 : felt; - builtin.ret v271; + private builtin.function @intrinsics::felt::as_u64(v272: felt) -> i64 { + ^block37(v272: felt): + v273 = hir.cast v272 : i64; + builtin.ret v273; }; - private builtin.function @intrinsics::felt::as_u64(v273: felt) -> i64 { - ^block38(v273: felt): - v274 = hir.cast v273 : i64; - builtin.ret v274; + 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::assert_eq(v276: felt, v277: felt) { - ^block40(v276: felt, v277: felt): - hir.assert_eq v276, v277; - 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::advice::adv_push_mapvaln(v278: felt, v279: felt, v280: felt, v281: felt) -> felt { - ^block42(v278: felt, v279: felt, v280: felt, v281: felt): - v282 = hir.exec @intrinsics/advice/adv_push_mapvaln(v278, v279, v280, v281) : felt - builtin.ret v282; + 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(v284: felt, v285: i32, v286: felt, v287: felt, v288: felt, v289: felt) -> i32 { - ^block45(v284: felt, v285: i32, v286: felt, v287: felt, v288: felt, v289: felt): - v290 = hir.exec @std/mem/pipe_preimage_to_memory(v284, v285, v286, v287, v288, v289) : i32 - builtin.ret v290; + 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::raw_vec::RawVecInner::try_allocate_in(v292: i32, v293: i32, v294: i32, v295: i32, v296: i32) { - ^block49(v292: i32, v293: i32, v294: i32, v295: i32, v296: i32): - v299 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v300 = hir.bitcast v299 : ptr; - v301 = hir.load v300 : i32; - v302 = arith.constant 16 : i32; - v303 = arith.sub v301, v302 : i32 #[overflow = wrapping]; - v304 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v305 = hir.bitcast v304 : ptr; - hir.store v305, v303; - v315 = hir.bitcast v293 : u32; - v316 = arith.zext v315 : u64; - v317 = hir.bitcast v316 : i64; - v297 = arith.constant 0 : i32; - v310 = arith.sub v297, v295 : i32 #[overflow = wrapping]; - v307 = arith.constant -1 : i32; - v306 = arith.add v295, v296 : i32 #[overflow = wrapping]; - v308 = arith.add v306, v307 : i32 #[overflow = wrapping]; - v311 = arith.band v308, v310 : i32; - v312 = hir.bitcast v311 : u32; - v313 = arith.zext v312 : u64; - v314 = hir.bitcast v313 : i64; - v318 = arith.mul v314, v317 : i64 #[overflow = wrapping]; - v712 = arith.constant 0 : i32; - v319 = arith.constant 32 : i64; - v321 = hir.cast v319 : u32; - v320 = hir.bitcast v318 : u64; - v322 = arith.shr v320, v321 : u64; - v323 = hir.bitcast v322 : i64; - v324 = arith.trunc v323 : i32; - v326 = arith.neq v324, v712 : i1; - v624, v625, v626, v627, v628, v629 = scf.if v326 : i32, i32, i32, i32, i32, u32 { + 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: - v609 = arith.constant 0 : u32; - v616 = ub.poison i32 : i32; - scf.yield v292, v303, v616, v616, v616, v609; + scf.yield v292; + } else { + ^block52: + 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; + } else { + ^block54: + v303 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v293, v292) : i32 + scf.yield v303; + }; + scf.yield v613; + }; + 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; + 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; + 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; } else { - ^block54: - v327 = arith.trunc v318 : i32; - v711 = arith.constant 0 : i32; - v328 = arith.constant -2147483648 : i32; - v329 = arith.sub v328, v295 : i32 #[overflow = wrapping]; - v331 = hir.bitcast v329 : u32; - v330 = hir.bitcast v327 : u32; - v332 = arith.lte v330, v331 : i1; - v333 = arith.zext v332 : u32; - v334 = hir.bitcast v333 : i32; - v336 = arith.neq v334, v711 : i1; - v672 = scf.if v336 : i32 { - ^block52: - v710 = arith.constant 0 : i32; - v347 = arith.neq v327, v710 : i1; - v671 = scf.if v347 : i32 { - ^block56: - v709 = arith.constant 0 : i32; - v363 = arith.neq v294, v709 : i1; - v670 = scf.if v363 : i32 { - ^block59: - v345 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::alloc::Global::alloc_impl(v303, v295, v327, v345) - v374 = hir.bitcast v303 : u32; - v419 = arith.constant 4 : u32; - v376 = arith.mod v374, v419 : u32; - hir.assertz v376 #[code = 250]; - v377 = hir.int_to_ptr v374 : ptr; - v378 = hir.load v377 : i32; - scf.yield v378; + ^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; } else { - ^block60: - v364 = arith.constant 8 : i32; - v365 = arith.add v303, v364 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::allocate(v365, v295, v327) - v349 = arith.constant 8 : u32; - v366 = hir.bitcast v303 : u32; - v368 = arith.add v366, v349 : u32 #[overflow = checked]; - v708 = arith.constant 4 : u32; - v370 = arith.mod v368, v708 : u32; - hir.assertz v370 #[code = 250]; - v371 = hir.int_to_ptr v368 : ptr; - v372 = hir.load v371 : i32; - scf.yield v372; + ^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; }; - v706 = arith.constant 0 : i32; - v707 = arith.constant 0 : i32; - v381 = arith.eq v670, v707 : i1; - v382 = arith.zext v381 : u32; - v383 = hir.bitcast v382 : i32; - v385 = arith.neq v383, v706 : i1; - scf.if v385{ - ^block61: - v705 = arith.constant 8 : u32; - v402 = hir.bitcast v292 : u32; - v404 = arith.add v402, v705 : u32 #[overflow = checked]; - v704 = arith.constant 4 : u32; - v406 = arith.mod v404, v704 : u32; - hir.assertz v406 #[code = 250]; - v407 = hir.int_to_ptr v404 : ptr; - hir.store v407, v327; - v703 = arith.constant 4 : u32; - v409 = hir.bitcast v292 : u32; - v411 = arith.add v409, v703 : u32 #[overflow = checked]; - v702 = arith.constant 4 : u32; - v413 = arith.mod v411, v702 : u32; - hir.assertz v413 #[code = 250]; - v414 = hir.int_to_ptr v411 : ptr; - hir.store v414, v295; + 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; scf.yield ; } else { - ^block62: - v701 = arith.constant 8 : u32; - v387 = hir.bitcast v292 : u32; - v389 = arith.add v387, v701 : u32 #[overflow = checked]; - v700 = arith.constant 4 : u32; - v391 = arith.mod v389, v700 : u32; - hir.assertz v391 #[code = 250]; - v392 = hir.int_to_ptr v389 : ptr; - hir.store v392, v670; - v699 = arith.constant 4 : u32; - v394 = hir.bitcast v292 : u32; - v396 = arith.add v394, v699 : u32 #[overflow = checked]; - v698 = arith.constant 4 : u32; - v398 = arith.mod v396, v698 : u32; - hir.assertz v398 #[code = 250]; - v399 = hir.int_to_ptr v396 : ptr; - hir.store v399, v293; + ^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; scf.yield ; }; - v696 = arith.constant 0 : i32; - v697 = arith.constant 1 : i32; - v669 = cf.select v385, v697, v696 : i32; - scf.yield v669; + v711 = arith.constant 1 : i32; + v712 = arith.constant 0 : i32; + v684 = cf.select v449, v712, v711 : i32; + scf.yield v684; } else { - ^block57: - v695 = arith.constant 8 : u32; - v348 = hir.bitcast v292 : u32; - v350 = arith.add v348, v695 : u32 #[overflow = checked]; - v694 = arith.constant 4 : u32; - v352 = arith.mod v350, v694 : u32; - hir.assertz v352 #[code = 250]; - v353 = hir.int_to_ptr v350 : ptr; - hir.store v353, v295; - v693 = arith.constant 4 : u32; - v356 = hir.bitcast v292 : u32; - v358 = arith.add v356, v693 : u32 #[overflow = checked]; - v692 = arith.constant 4 : u32; - v360 = arith.mod v358, v692 : u32; - hir.assertz v360 #[code = 250]; - v691 = arith.constant 0 : i32; - v361 = hir.int_to_ptr v358 : ptr; - hir.store v361, v691; - v690 = arith.constant 0 : i32; - scf.yield v690; + ^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; }; - scf.yield v671; + scf.yield v686; } else { - ^block55: - v689 = ub.poison i32 : i32; - scf.yield v689; + ^block63: + v704 = ub.poison i32 : i32; + scf.yield v704; }; - v684 = arith.constant 0 : u32; - v617 = arith.constant 1 : u32; - v677 = cf.select v336, v617, v684 : u32; - v685 = ub.poison i32 : i32; - v676 = cf.select v336, v303, v685 : i32; - v686 = ub.poison i32 : i32; - v675 = cf.select v336, v292, v686 : i32; - v687 = ub.poison i32 : i32; - v674 = cf.select v336, v687, v303 : i32; - v688 = ub.poison i32 : i32; - v673 = cf.select v336, v688, v292 : i32; - scf.yield v673, v674, v675, v672, v676, v677; + 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; }; - v630, v631, v632 = scf.index_switch v629 : i32, i32, i32 + v645, v646, v647 = scf.index_switch v644 : i32, i32, i32 case 0 { - ^block53: - v683 = arith.constant 4 : u32; - v339 = hir.bitcast v624 : u32; - v341 = arith.add v339, v683 : u32 #[overflow = checked]; - v682 = arith.constant 4 : u32; - v343 = arith.mod v341, v682 : u32; - hir.assertz v343 #[code = 250]; - v681 = arith.constant 0 : i32; - v344 = hir.int_to_ptr v341 : ptr; - hir.store v344, v681; - v680 = arith.constant 1 : i32; - scf.yield v624, v680, v625; + ^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; } default { - ^block99: - scf.yield v626, v627, v628; - }; - v418 = hir.bitcast v630 : u32; - v679 = arith.constant 4 : u32; - v420 = arith.mod v418, v679 : u32; - hir.assertz v420 #[code = 250]; - v421 = hir.int_to_ptr v418 : ptr; - hir.store v421, v631; - v678 = arith.constant 16 : i32; - v426 = arith.add v632, v678 : i32 #[overflow = wrapping]; - v427 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v428 = hir.bitcast v427 : ptr; - hir.store v428, v426; - builtin.ret ; - }; - - private builtin.function @::allocate(v429: i32, v430: i32, v431: i32) { - ^block63(v429: i32, v430: i32, v431: i32): - v433 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v434 = hir.bitcast v433 : ptr; - v435 = hir.load v434 : i32; - v436 = arith.constant 16 : i32; - v437 = arith.sub v435, v436 : i32 #[overflow = wrapping]; - v438 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v439 = hir.bitcast v438 : ptr; - hir.store v439, v437; - v432 = arith.constant 0 : i32; - v440 = arith.constant 8 : i32; - v441 = arith.add v437, v440 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::alloc::Global::alloc_impl(v441, v430, v431, v432) - v444 = arith.constant 12 : u32; - v443 = hir.bitcast v437 : u32; - v445 = arith.add v443, v444 : u32 #[overflow = checked]; - v446 = arith.constant 4 : u32; - v447 = arith.mod v445, v446 : u32; - hir.assertz v447 #[code = 250]; - v448 = hir.int_to_ptr v445 : ptr; - v449 = hir.load v448 : i32; - v451 = arith.constant 8 : u32; - v450 = hir.bitcast v437 : u32; - v452 = arith.add v450, v451 : u32 #[overflow = checked]; - v717 = arith.constant 4 : u32; - v454 = arith.mod v452, v717 : u32; - hir.assertz v454 #[code = 250]; - v455 = hir.int_to_ptr v452 : ptr; - v456 = hir.load v455 : i32; - v457 = hir.bitcast v429 : u32; - v716 = arith.constant 4 : u32; - v459 = arith.mod v457, v716 : u32; - hir.assertz v459 #[code = 250]; - v460 = hir.int_to_ptr v457 : ptr; - hir.store v460, v456; - v715 = arith.constant 4 : u32; - v461 = hir.bitcast v429 : u32; - v463 = arith.add v461, v715 : u32 #[overflow = checked]; - v714 = arith.constant 4 : u32; - v465 = arith.mod v463, v714 : u32; - hir.assertz v465 #[code = 250]; - v466 = hir.int_to_ptr v463 : ptr; - hir.store v466, v449; - v713 = arith.constant 16 : i32; - v468 = arith.add v437, v713 : i32 #[overflow = wrapping]; - v469 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v470 = hir.bitcast v469 : ptr; - hir.store v470, v468; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v471: i32, v472: i32, v473: i32, v474: i32) { - ^block65(v471: i32, v472: i32, v473: i32, v474: i32): - v733 = arith.constant 0 : i32; - v475 = arith.constant 0 : i32; - v476 = arith.eq v473, v475 : i1; - v477 = arith.zext v476 : u32; - v478 = hir.bitcast v477 : i32; - v480 = arith.neq v478, v733 : i1; - v729 = scf.if v480 : i32 { ^block102: - scf.yield v472; - } else { - ^block68: - hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v732 = arith.constant 0 : i32; - v482 = arith.neq v474, v732 : i1; - v728 = scf.if v482 : i32 { - ^block69: - v484 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc_zeroed(v473, v472) : i32 - scf.yield v484; - } else { - ^block70: - v483 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v473, v472) : i32 - scf.yield v483; - }; - scf.yield v728; + scf.yield v641, v642, v643; }; - v488 = arith.constant 4 : u32; - v487 = hir.bitcast v471 : u32; - v489 = arith.add v487, v488 : u32 #[overflow = checked]; - v731 = arith.constant 4 : u32; - v491 = arith.mod v489, v731 : u32; - hir.assertz v491 #[code = 250]; - v492 = hir.int_to_ptr v489 : ptr; - hir.store v492, v473; - v494 = hir.bitcast v471 : u32; - v730 = arith.constant 4 : u32; - v496 = arith.mod v494, v730 : u32; - hir.assertz v496 #[code = 250]; - v497 = hir.int_to_ptr v494 : ptr; - hir.store v497, v729; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v498: i32, v499: i32, v500: i32) { - ^block71(v498: i32, v499: i32, v500: i32): + private builtin.function @alloc::raw_vec::handle_error(v493: i32, v494: i32) { + ^block71(v493: i32, v494: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v501: i32, v502: i32) -> i32 { - ^block73(v501: i32, v502: i32): - v509 = arith.constant 0 : i32; - v505 = hir.bitcast v502 : u32; - v504 = hir.bitcast v501 : u32; - v506 = arith.gt v504, v505 : i1; - v507 = arith.zext v506 : u32; - v508 = hir.bitcast v507 : i32; - v510 = arith.neq v508, v509 : i1; - v511 = cf.select v510, v501, v502 : i32; - builtin.ret v511; + 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; }; builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; - - builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/adv_load_preimage.masm b/tests/integration/expected/adv_load_preimage.masm index a90503491..f23f95e02 100644 --- a/tests/integration/expected/adv_load_preimage.masm +++ b/tests/integration/expected/adv_load_preimage.masm @@ -5,24 +5,104 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] - adv.push_mapval - push.262144 - push.2 - trace.240 - exec.::std::mem::pipe_preimage_to_memory - trace.252 - drop push.1048576 u32assert - mem_store.278536 + mem_store.278528 end # mod root_ns:root@1.0.0::adv_load_preimage +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048576 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048576 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::::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(i32, felt, felt, felt, felt) - push.1114144 + push.1114112 u32divmod.4 swap.1 trace.240 @@ -32,7 +112,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop push.16 u32wrapping_sub - push.1114144 + push.1114112 dup.1 swap.1 u32divmod.4 @@ -125,7 +205,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::alloc::raw_vec::RawVecInner::try_allocate_in + exec.::root_ns:root@1.0.0::adv_load_preimage::::try_allocate_in trace.252 nop push.8 @@ -198,8 +278,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.1048588 - swap.2 + swap.1 trace.240 nop exec.::root_ns:root@1.0.0::adv_load_preimage::alloc::raw_vec::handle_error @@ -450,7 +529,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) push.16 movup.2 u32wrapping_add - push.1114144 + push.1114112 u32divmod.4 swap.1 trace.240 @@ -476,94 +555,6 @@ pub proc entrypoint(i32, felt, felt, felt, felt) end end -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048604 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::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") proc __rustc::__rust_no_alloc_shim_is_unstable_v2( @@ -602,7 +593,7 @@ proc ::alloc( movup.2 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::core::ptr::alignment::Alignment::max + exec.::root_ns:root@1.0.0::adv_load_preimage::::max trace.252 nop push.0 @@ -763,24 +754,12 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 +proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt trace.240 nop - exec.::std::math::u64::lt + exec.::intrinsics::advice::adv_push_mapvaln trace.252 nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop end @callconv("C") @@ -794,12 +773,24 @@ proc intrinsics::felt::assert_eq(felt, felt) end @callconv("C") -proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt +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.::intrinsics::advice::adv_push_mapvaln + exec.::std::math::u64::lt trace.252 nop + assert + mul.4294967296 + add end @callconv("C") @@ -812,59 +803,256 @@ proc std::mem::pipe_preimage_to_memory(felt, i32, felt, felt, felt, felt) -> i32 end @callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( - i32, +proc ::alloc_impl( 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.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::__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::adv_load_preimage::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::__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 ::allocate( + i32, + i32, + i32 +) + push.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114112 + 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::adv_load_preimage::::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.1114112 + 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.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114112 + 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 @@ -923,7 +1111,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::alloc::alloc::Global::alloc_impl + exec.::root_ns:root@1.0.0::adv_load_preimage::::alloc_impl trace.252 nop dup.2 @@ -971,14 +1159,12 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop end push.0 - push.0 - dup.2 - eq + dup.1 neq dup.0 if.true - movup.6 - movup.2 + movup.7 + movup.4 drop drop push.8 @@ -991,7 +1177,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.3 + movup.2 swap.1 u32divmod.4 swap.1 @@ -1020,8 +1206,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop else - movup.7 - movup.4 + movup.6 + movup.2 drop drop push.8 @@ -1034,7 +1220,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.2 + movup.3 swap.1 u32divmod.4 swap.1 @@ -1063,8 +1249,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop end - push.0 push.1 + push.0 movup.2 cdrop else @@ -1214,204 +1400,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( 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 ::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::adv_load_preimage::alloc::alloc::Global::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 alloc::alloc::Global::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::adv_load_preimage::__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::adv_load_preimage::__rustc::__rust_alloc_zeroed - trace.252 - nop - else - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::__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 + push.1114112 u32divmod.4 swap.1 trace.240 @@ -1422,8 +1411,7 @@ proc alloc::alloc::Global::alloc_impl( end @callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop +proc alloc::raw_vec::handle_error(i32, i32) drop drop push.0 @@ -1431,7 +1419,10 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) end @callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 +proc ::max( + i32, + i32 +) -> i32 push.0 dup.2 dup.2 diff --git a/tests/integration/expected/adv_load_preimage.wat b/tests/integration/expected/adv_load_preimage.wat index 399021d87..eae5f281d 100644 --- a/tests/integration/expected/adv_load_preimage.wat +++ b/tests/integration/expected/adv_load_preimage.wat @@ -1,24 +1,50 @@ (module $adv_load_preimage.wasm - (type (;0;) (func (param i32 f32 f32 f32 f32))) - (type (;1;) (func (param i32 i32) (result i32))) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32 f32 f32 f32 f32))) (type (;2;) (func)) (type (;3;) (func (param i32 i32 i32) (result i32))) (type (;4;) (func (result i32))) - (type (;5;) (func (param i64) (result f32))) - (type (;6;) (func (param i32) (result f32))) - (type (;7;) (func (param f32) (result i64))) - (type (;8;) (func (param f32 f32))) - (type (;9;) (func (param f32 f32 f32 f32) (result f32))) + (type (;5;) (func (param f32 f32 f32 f32) (result f32))) + (type (;6;) (func (param f32) (result i64))) + (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 i32 f32 f32 f32 f32) (result i32))) - (type (;11;) (func (param i32 i32 i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32 i32))) (type (;12;) (func (param i32 i32 i32))) - (type (;13;) (func (param i32 i32 i32 i32))) + (type (;13;) (func (param i32 i32 i32 i32 i32))) + (type (;14;) (func (param i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;0;) (type 0) (param i32 f32 f32 f32 f32) + (func $__rustc::__rust_alloc (;0;) (type 0) (param i32 i32) (result i32) + i32.const 1048576 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_alloc_zeroed (;1;) (type 0) (param i32 i32) (result i32) + block ;; label = @1 + i32.const 1048576 + 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 (;2;) (type 1) (param i32 f32 f32 f32 f32) (local i32 i64 f32 i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -55,7 +81,7 @@ i32.const 0 i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::try_allocate_in + call $::try_allocate_in local.get 5 i32.load offset=8 local.set 9 @@ -127,36 +153,10 @@ local.get 9 local.get 5 i32.load offset=12 - i32.const 1048588 call $alloc::raw_vec::handle_error end unreachable ) - (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_alloc_zeroed (;2;) (type 1) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - 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 $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 2) return ) @@ -179,7 +179,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -235,25 +235,81 @@ (func $intrinsics::mem::heap_base (;5;) (type 4) (result i32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;6;) (type 5) (param i64) (result f32) + (func $intrinsics::advice::adv_push_mapvaln (;6;) (type 5) (param f32 f32 f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;7;) (type 6) (param i32) (result f32) + (func $intrinsics::felt::as_u64 (;7;) (type 6) (param f32) (result i64) unreachable ) - (func $intrinsics::felt::as_u64 (;8;) (type 7) (param f32) (result i64) + (func $intrinsics::felt::assert_eq (;8;) (type 7) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;9;) (type 8) (param f32 f32) + (func $intrinsics::felt::from_u32 (;9;) (type 8) (param i32) (result f32) unreachable ) - (func $intrinsics::advice::adv_push_mapvaln (;10;) (type 9) (param f32 f32 f32 f32) (result f32) + (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) unreachable ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;12;) (type 11) (param i32 i32 i32 i32 i32) + (func $::alloc_impl (;12;) (type 11) (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 $::allocate (;13;) (type 12) (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 (;14;) (type 13) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -329,32 +385,31 @@ local.get 3 local.get 4 i32.const 1 - call $alloc::alloc::Global::alloc_impl + call $::alloc_impl local.get 5 i32.load local.set 2 end block ;; label = @2 local.get 2 - i32.eqz br_if 0 (;@2;) local.get 0 - local.get 2 + local.get 4 i32.store offset=8 local.get 0 - local.get 1 + local.get 3 i32.store offset=4 - i32.const 0 + i32.const 1 local.set 3 br 1 (;@1;) end local.get 0 - local.get 4 + local.get 2 i32.store offset=8 local.get 0 - local.get 3 + local.get 1 i32.store offset=4 - i32.const 1 + i32.const 0 local.set 3 end local.get 0 @@ -365,66 +420,10 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;13;) (type 12) (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::alloc::Global::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 $alloc::alloc::Global::alloc_impl (;14;) (type 13) (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 $alloc::raw_vec::handle_error (;15;) (type 12) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;15;) (type 14) (param i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;16;) (type 1) (param i32 i32) (result i32) + (func $::max (;16;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -432,5 +431,4 @@ i32.gt_u select ) - (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/examples/auth_component_no_auth.hir b/tests/integration/expected/examples/auth_component_no_auth.hir index 4fafeea1b..cfbba0dea 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.hir +++ b/tests/integration/expected/examples/auth_component_no_auth.hir @@ -58,7 +58,7 @@ builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v9, v41) + 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) @@ -98,7 +98,7 @@ builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v71, v73) + 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]; @@ -275,7 +275,7 @@ builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v186: i32, v187: i32) { + 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; @@ -409,9 +409,9 @@ builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { builtin.ret v278; }; - private builtin.function @miden::active_account::get_initial_commitment(v280: i32) { + private builtin.function @miden::active_account::compute_commitment(v280: i32) { ^block29(v280: i32): - v281, v282, v283, v284 = hir.exec @miden/active_account/get_initial_commitment() : felt, felt, felt, felt + 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; @@ -430,9 +430,9 @@ builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { builtin.ret ; }; - private builtin.function @miden::active_account::compute_commitment(v296: i32) { + private builtin.function @miden::active_account::get_initial_commitment(v296: i32) { ^block33(v296: i32): - v297, v298, v299, v300 = hir.exec @miden/active_account/compute_commitment() : felt, felt, felt, felt + 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; diff --git a/tests/integration/expected/examples/auth_component_no_auth.masm b/tests/integration/expected/examples/auth_component_no_auth.masm index 5486fa27f..4ab35ddef 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.masm +++ b/tests/integration/expected/examples/auth_component_no_auth.masm @@ -172,7 +172,7 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( dup.1 trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::::reverse trace.252 nop push.32 @@ -265,7 +265,7 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( u32wrapping_add trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::::reverse trace.252 nop push.16 @@ -580,7 +580,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -862,10 +862,10 @@ proc intrinsics::felt::eq(felt, felt) -> i32 end @callconv("C") -proc miden::active_account::get_initial_commitment(i32) +proc miden::active_account::compute_commitment(i32) trace.240 nop - exec.::miden::active_account::get_initial_commitment + exec.::miden::active_account::compute_commitment trace.252 nop movup.4 @@ -918,10 +918,10 @@ proc miden::active_account::get_initial_commitment(i32) end @callconv("C") -proc miden::active_account::compute_commitment(i32) +proc miden::active_account::get_initial_commitment(i32) trace.240 nop - exec.::miden::active_account::compute_commitment + exec.::miden::active_account::get_initial_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/examples/auth_component_no_auth.wat b/tests/integration/expected/examples/auth_component_no_auth.wat index 534f70666..e272f897f 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.wat +++ b/tests/integration/expected/examples/auth_component_no_auth.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 4 i32.const 48 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 4 i32.const 32 i32.add @@ -68,7 +68,7 @@ local.get 4 i32.const 48 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse block ;; label = @1 block ;; label = @2 local.get 4 @@ -130,7 +130,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -191,10 +191,10 @@ (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $miden::active_account::get_initial_commitment (;6;) (type 4) (param i32) + (func $miden::active_account::compute_commitment (;6;) (type 4) (param i32) unreachable ) - (func $miden::active_account::compute_commitment (;7;) (type 4) (param i32) + (func $miden::active_account::get_initial_commitment (;7;) (type 4) (param i32) unreachable ) (func $miden::native_account::incr_nonce (;8;) (type 5) (result f32) @@ -203,15 +203,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure" (core func $miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure (;0;))) + (func $auth-procedure (;0;) (type 2) (canon lift (core func $miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:auth-component-no-auth/auth-component-no-auth@0.1.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -224,12 +224,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "auth-procedure" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-auth-procedure" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:auth-component-no-auth/auth-component-no-auth@0.1.0-shim-instance (;1;) (instantiate $miden:auth-component-no-auth/auth-component-no-auth@0.1.0-shim-component + (with "import-func-auth-procedure" (func $auth-procedure)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:auth-component-no-auth/auth-component-no-auth@0.1.0" (instance 1)) + (export $miden:auth-component-no-auth/auth-component-no-auth@0.1.0 (;2;) "miden:auth-component-no-auth/auth-component-no-auth@0.1.0" (instance $miden:auth-component-no-auth/auth-component-no-auth@0.1.0-shim-instance)) ) diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir index 0d831231f..bc8ffaab5 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir @@ -15,7 +15,7 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 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 112 : 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; @@ -23,10 +23,10 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 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 80 : i32; + 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 88 : u32; + v22 = arith.constant 152 : u32; v21 = hir.bitcast v14 : u32; v23 = arith.add v21, v22 : u32 #[overflow = checked]; v24 = arith.constant 8 : u32; @@ -34,33 +34,33 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i64; - v29 = arith.constant 104 : u32; + v29 = arith.constant 56 : u32; v28 = hir.bitcast v14 : u32; v30 = arith.add v28, v29 : u32 #[overflow = checked]; - v838 = arith.constant 8 : u32; - v32 = arith.mod v30, v838 : u32; + 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 80 : u32; + v35 = arith.constant 144 : u32; v34 = hir.bitcast v14 : u32; v36 = arith.add v34, v35 : u32 #[overflow = checked]; - v837 = arith.constant 8 : u32; - v38 = arith.mod v36, v837 : u32; + 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 96 : u32; + v42 = arith.constant 48 : u32; v41 = hir.bitcast v14 : u32; v43 = arith.add v41, v42 : u32 #[overflow = checked]; - v836 = arith.constant 8 : u32; - v45 = arith.mod v43, v836 : u32; + 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 96 : i32; + 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v14, v48) + 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) @@ -69,317 +69,417 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 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 - v835 = 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(v835) : felt - v59 = arith.constant 60 : u32; - v58 = hir.bitcast v14 : u32; - v60 = arith.add v58, v59 : u32 #[overflow = checked]; - v61 = arith.constant 4 : u32; - v62 = arith.mod v60, v61 : u32; - hir.assertz v62 #[code = 250]; - v63 = hir.int_to_ptr v60 : ptr; - hir.store v63, v18; - v65 = arith.constant 56 : u32; - v64 = hir.bitcast v14 : u32; - v66 = arith.add v64, v65 : u32 #[overflow = checked]; - v834 = arith.constant 4 : u32; - v68 = arith.mod v66, v834 : u32; - hir.assertz v68 #[code = 250]; - v69 = hir.int_to_ptr v66 : ptr; - hir.store v69, v17; - v71 = arith.constant 52 : u32; - v70 = hir.bitcast v14 : u32; - v72 = arith.add v70, v71 : u32 #[overflow = checked]; - v833 = arith.constant 4 : u32; - v74 = arith.mod v72, v833 : u32; - hir.assertz v74 #[code = 250]; - v75 = hir.int_to_ptr v72 : ptr; - hir.store v75, v57; - v77 = arith.constant 48 : u32; - v76 = hir.bitcast v14 : u32; - v78 = arith.add v76, v77 : u32 #[overflow = checked]; - v832 = arith.constant 4 : u32; - v80 = arith.mod v78, v832 : u32; - hir.assertz v80 #[code = 250]; - v81 = hir.int_to_ptr v78 : ptr; - hir.store v81, v55; - v831 = arith.constant 0 : i32; - v83 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v831) : felt - v830 = arith.constant 0 : i32; - v85 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v830) : felt - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::assert_eq(v83, v85) - v649 = arith.constant 2 : u32; - v87 = hir.bitcast v14 : u32; - v89 = arith.shr v87, v649 : u32; - v90 = hir.bitcast v89 : i32; - v828 = arith.constant 80 : i32; - v94 = arith.add v14, v828 : i32 #[overflow = wrapping]; - v829 = arith.constant 16 : i32; - v92 = arith.add v90, v829 : 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(v90, v92, v94) - v827 = arith.constant 88 : u32; - v95 = hir.bitcast v14 : u32; - v97 = arith.add v95, v827 : u32 #[overflow = checked]; - v826 = arith.constant 8 : u32; - v99 = arith.mod v97, v826 : u32; + 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.assertz v95 #[code = 250]; + 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; - v825 = arith.constant 104 : u32; + v922 = arith.constant 48 : u32; v102 = hir.bitcast v14 : u32; - v104 = arith.add v102, v825 : u32 #[overflow = checked]; - v824 = arith.constant 8 : u32; - v106 = arith.mod v104, v824 : 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; - v823 = arith.constant 80 : u32; + v109 = arith.constant 16 : u32; v108 = hir.bitcast v14 : u32; - v110 = arith.add v108, v823 : u32 #[overflow = checked]; - v822 = arith.constant 8 : u32; - v112 = arith.mod v110, v822 : 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; - v821 = arith.constant 96 : u32; + v116 = arith.constant 64 : u32; v115 = hir.bitcast v14 : u32; - v117 = arith.add v115, v821 : u32 #[overflow = checked]; - v820 = arith.constant 8 : u32; - v119 = arith.mod v117, v820 : 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; - v819 = arith.constant 96 : i32; - v124 = arith.add v14, v819 : i32 #[overflow = wrapping]; - v121 = arith.constant 64 : i32; - v122 = arith.add v14, v121 : 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::word::Word::reverse(v122, v124) - v126 = arith.constant 64 : u32; - v125 = hir.bitcast v14 : u32; - v127 = arith.add v125, v126 : u32 #[overflow = checked]; - v818 = arith.constant 4 : u32; - v129 = arith.mod v127, v818 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : felt; - v133 = arith.constant 68 : u32; - v132 = hir.bitcast v14 : u32; - v134 = arith.add v132, v133 : u32 #[overflow = checked]; - v817 = arith.constant 4 : u32; - v136 = arith.mod v134, v817 : u32; - hir.assertz v136 #[code = 250]; - v137 = hir.int_to_ptr v134 : ptr; - v138 = hir.load v137 : felt; - v140 = arith.constant 72 : u32; - v139 = hir.bitcast v14 : u32; - v141 = arith.add v139, v140 : u32 #[overflow = checked]; - v816 = arith.constant 4 : u32; - v143 = arith.mod v141, v816 : u32; - hir.assertz v143 #[code = 250]; - v144 = hir.int_to_ptr v141 : ptr; - v145 = hir.load v144 : felt; - v147 = arith.constant 76 : u32; + 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]; - v815 = arith.constant 4 : u32; - v150 = arith.mod v148, v815 : u32; + v915 = arith.constant 4 : u32; + v150 = arith.mod v148, v915 : u32; hir.assertz v150 #[code = 250]; v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v153 = arith.constant 48 : i32; - v154 = arith.add v14, v153 : i32 #[overflow = wrapping]; - v814 = arith.constant 0 : i32; - v747, v748, v749, v750, v751, v752, v753, v754, v755, v756, v757, v758 = scf.while v814, v14, v154, v152, v145, v138, v131 : i32, i32, i32, felt, felt, felt, felt, i32, felt, felt, felt, felt { - ^block86(v759: i32, v760: i32, v761: i32, v762: felt, v763: felt, v764: felt, v765: felt): - v812 = arith.constant 0 : i32; - v813 = arith.constant 32 : i32; - v157 = arith.eq v759, v813 : i1; - v158 = arith.zext v157 : u32; - v159 = hir.bitcast v158 : i32; - v161 = arith.neq v159, v812 : i1; - v738, v739 = scf.if v161 : i32, i32 { + 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]; + v165 = hir.bitcast v163 : u32; + v167 = arith.shr v165, v731 : 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: - v661 = ub.poison i32 : i32; - scf.yield v661, v661; + v743 = ub.poison i32 : i32; + scf.yield v743, v743; } else { ^block14: - v200 = arith.constant 4 : i32; - v163 = arith.add v760, v759 : 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(v163, v761, v200) - v168 = arith.constant -16 : i32; - v169 = arith.add v761, v168 : i32 #[overflow = wrapping]; - v811 = arith.constant 16 : i32; - v167 = arith.add v759, v811 : i32 #[overflow = wrapping]; - scf.yield v167, v169; + 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; }; - v807 = ub.poison felt : felt; - v744 = cf.select v161, v807, v765 : felt; - v808 = ub.poison felt : felt; - v743 = cf.select v161, v808, v764 : felt; - v809 = ub.poison felt : felt; - v742 = cf.select v161, v809, v763 : felt; - v662 = ub.poison felt : felt; - v741 = cf.select v161, v662, v762 : felt; - v810 = ub.poison i32 : i32; - v740 = cf.select v161, v810, v760 : i32; - v660 = arith.constant 1 : u32; - v650 = arith.constant 0 : u32; - v746 = cf.select v161, v650, v660 : u32; - v728 = arith.trunc v746 : i1; - scf.condition v728, v738, v740, v739, v741, v742, v743, v744, v760, v762, v763, v764, v765; + 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; } do { - ^block87(v766: i32, v767: i32, v768: i32, v769: felt, v770: felt, v771: felt, v772: felt, v773: i32, v774: felt, v775: felt, v776: felt, v777: felt): - scf.yield v766, v767, v768, v769, v770, v771, v772; + ^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; }; - v172 = arith.constant 108 : u32; - v171 = hir.bitcast v754 : u32; - v173 = arith.add v171, v172 : u32 #[overflow = checked]; - v806 = arith.constant 4 : u32; - v175 = arith.mod v173, v806 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - hir.store v176, v755; - v805 = arith.constant 104 : u32; - v178 = hir.bitcast v754 : u32; - v180 = arith.add v178, v805 : u32 #[overflow = checked]; - v804 = arith.constant 4 : u32; - v182 = arith.mod v180, v804 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - hir.store v183, v756; - v186 = arith.constant 100 : u32; - v185 = hir.bitcast v754 : u32; - v187 = arith.add v185, v186 : u32 #[overflow = checked]; - v803 = arith.constant 4 : u32; - v189 = arith.mod v187, v803 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v757; - v802 = arith.constant 96 : u32; - v192 = hir.bitcast v754 : u32; - v194 = arith.add v192, v802 : u32 #[overflow = checked]; - v801 = arith.constant 4 : u32; - v196 = arith.mod v194, v801 : u32; - hir.assertz v196 #[code = 250]; - v197 = hir.int_to_ptr v194 : ptr; - hir.store v197, v758; - v799 = arith.constant 4 : i32; - v800 = arith.constant 96 : i32; - v199 = arith.add v754, v800 : 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(v199, v754, v799) - v798 = arith.constant 0 : i32; - v202 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/>::from(v798) : felt - v797 = arith.constant 80 : i32; - v204 = arith.add v754, v797 : 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(v202, v204) - v796 = arith.constant 88 : u32; - v205 = hir.bitcast v754 : u32; - v207 = arith.add v205, v796 : u32 #[overflow = checked]; - v795 = arith.constant 8 : u32; - v209 = arith.mod v207, v795 : u32; - hir.assertz v209 #[code = 250]; - v210 = hir.int_to_ptr v207 : ptr; - v211 = hir.load v210 : i64; - v794 = arith.constant 104 : u32; - v212 = hir.bitcast v754 : u32; - v214 = arith.add v212, v794 : u32 #[overflow = checked]; - v793 = arith.constant 8 : u32; - v216 = arith.mod v214, v793 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - hir.store v217, v211; - v792 = arith.constant 80 : u32; - v218 = hir.bitcast v754 : u32; - v220 = arith.add v218, v792 : u32 #[overflow = checked]; - v791 = arith.constant 8 : u32; - v222 = arith.mod v220, v791 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - v224 = hir.load v223 : i64; - v790 = arith.constant 96 : u32; - v225 = hir.bitcast v754 : u32; - v227 = arith.add v225, v790 : u32 #[overflow = checked]; - v789 = arith.constant 8 : u32; - v229 = arith.mod v227, v789 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - hir.store v230, v224; - v787 = arith.constant 96 : i32; - v234 = arith.add v754, v787 : i32 #[overflow = wrapping]; - v788 = arith.constant 64 : i32; - v232 = arith.add v754, v788 : 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::word::Word::reverse(v232, v234) - v786 = arith.constant 76 : u32; - v235 = hir.bitcast v754 : u32; - v237 = arith.add v235, v786 : u32 #[overflow = checked]; - v785 = arith.constant 4 : u32; - v239 = arith.mod v237, v785 : u32; - hir.assertz v239 #[code = 250]; - v240 = hir.int_to_ptr v237 : ptr; - v241 = hir.load v240 : felt; - v784 = arith.constant 72 : u32; - v242 = hir.bitcast v754 : u32; - v244 = arith.add v242, v784 : u32 #[overflow = checked]; - v783 = arith.constant 4 : u32; - v246 = arith.mod v244, v783 : u32; - hir.assertz v246 #[code = 250]; - v247 = hir.int_to_ptr v244 : ptr; - v248 = hir.load v247 : felt; - v782 = arith.constant 68 : u32; - v249 = hir.bitcast v754 : u32; - v251 = arith.add v249, v782 : u32 #[overflow = checked]; - v781 = arith.constant 4 : u32; - v253 = arith.mod v251, v781 : u32; - hir.assertz v253 #[code = 250]; - v254 = hir.int_to_ptr v251 : ptr; - v255 = hir.load v254 : felt; - v780 = arith.constant 64 : u32; - v256 = hir.bitcast v754 : u32; - v258 = arith.add v256, v780 : u32 #[overflow = checked]; - v779 = arith.constant 4 : u32; - v260 = arith.mod v258, v779 : u32; - hir.assertz v260 #[code = 250]; - v261 = hir.int_to_ptr v258 : ptr; - v262 = hir.load v261 : 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(v755, v756, v757, v758, v241, v248, v255, v262) - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/std::crypto::dsa::rpo_falcon512::verify(v241, v248, v255, v262, v755, v756, v757, v758) - v778 = arith.constant 112 : i32; - v264 = arith.add v754, v778 : i32 #[overflow = wrapping]; - v265 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v266 = hir.bitcast v265 : ptr; - hir.store v266, v264; + 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; + 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; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v268 = 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 - v269 = hir.bitcast v268 : ptr; - v270 = hir.load v269 : i32; - v271 = arith.constant 1048584 : i32; - v272 = arith.add v270, v271 : i32 #[overflow = wrapping]; - v273 = hir.bitcast v272 : u32; - v274 = hir.int_to_ptr v273 : ptr; - v275 = hir.load v274 : u8; - v267 = arith.constant 0 : i32; - v276 = arith.zext v275 : u32; - v277 = hir.bitcast v276 : i32; - v279 = arith.neq v277, v267 : i1; - scf.if v279{ + 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: scf.yield ; } else { ^block18: - v280 = 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 - v281 = hir.bitcast v280 : ptr; - v282 = hir.load v281 : i32; + 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; hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__wasm_call_ctors() - v840 = arith.constant 1 : u8; - v842 = arith.constant 1048584 : i32; - v284 = arith.add v282, v842 : i32 #[overflow = wrapping]; - v288 = hir.bitcast v284 : u32; - v289 = hir.int_to_ptr v288 : ptr; - hir.store v289, v840; + 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; scf.yield ; }; builtin.ret ; @@ -387,484 +487,484 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 private builtin.function @miden_base_sys::bindings::tx::get_block_number() -> felt { ^block19: - v291 = 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 v291; + 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; }; - private builtin.function @miden_base_sys::bindings::tx::get_input_notes_commitment(v292: i32) { - ^block21(v292: i32): - v294 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v295 = hir.bitcast v294 : ptr; - v296 = hir.load v295 : i32; - v297 = arith.constant 32 : i32; - v298 = arith.sub v296, v297 : i32 #[overflow = wrapping]; - v299 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v300 = hir.bitcast v299 : ptr; - hir.store v300, v298; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::tx::get_input_notes_commitment(v298) - v302 = arith.constant 8 : u32; - v301 = hir.bitcast v298 : u32; - v303 = arith.add v301, v302 : u32 #[overflow = checked]; - v847 = arith.constant 8 : u32; - v305 = arith.mod v303, v847 : u32; - hir.assertz v305 #[code = 250]; - v306 = hir.int_to_ptr v303 : ptr; - v307 = hir.load v306 : i64; - v309 = arith.constant 24 : u32; - v308 = hir.bitcast v298 : u32; - v310 = arith.add v308, v309 : u32 #[overflow = checked]; - v846 = arith.constant 8 : u32; - v312 = arith.mod v310, v846 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - hir.store v313, v307; - v314 = hir.bitcast v298 : u32; - v845 = arith.constant 8 : u32; - v316 = arith.mod v314, v845 : u32; - hir.assertz v316 #[code = 250]; - v317 = hir.int_to_ptr v314 : ptr; - v318 = hir.load v317 : i64; - v320 = arith.constant 16 : u32; - v319 = hir.bitcast v298 : u32; - v321 = arith.add v319, v320 : u32 #[overflow = checked]; - v844 = arith.constant 8 : u32; - v323 = arith.mod v321, v844 : u32; - hir.assertz v323 #[code = 250]; - v324 = hir.int_to_ptr v321 : ptr; - hir.store v324, v318; - v325 = arith.constant 16 : i32; - v326 = arith.add v298, v325 : 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::word::Word::reverse(v292, v326) - v843 = arith.constant 32 : i32; - v328 = arith.add v298, v843 : i32 #[overflow = wrapping]; - v329 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v330 = hir.bitcast v329 : ptr; - hir.store v330, v328; + 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; + 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; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::get_output_notes_commitment(v331: i32) { - ^block23(v331: i32): - v333 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v334 = hir.bitcast v333 : ptr; - v335 = hir.load v334 : i32; - v336 = arith.constant 32 : i32; - v337 = arith.sub v335, v336 : i32 #[overflow = wrapping]; - v338 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v339 = hir.bitcast v338 : ptr; - hir.store v339, v337; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::tx::get_output_notes_commitment(v337) - v341 = arith.constant 8 : u32; - v340 = hir.bitcast v337 : u32; - v342 = arith.add v340, v341 : u32 #[overflow = checked]; - v852 = arith.constant 8 : u32; - v344 = arith.mod v342, v852 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - v346 = hir.load v345 : i64; - v348 = arith.constant 24 : u32; - v347 = hir.bitcast v337 : u32; - v349 = arith.add v347, v348 : u32 #[overflow = checked]; - v851 = arith.constant 8 : u32; - v351 = arith.mod v349, v851 : u32; - hir.assertz v351 #[code = 250]; - v352 = hir.int_to_ptr v349 : ptr; - hir.store v352, v346; - v353 = hir.bitcast v337 : u32; - v850 = arith.constant 8 : u32; - v355 = arith.mod v353, v850 : u32; - hir.assertz v355 #[code = 250]; - v356 = hir.int_to_ptr v353 : ptr; - v357 = hir.load v356 : i64; - v359 = arith.constant 16 : u32; - v358 = hir.bitcast v337 : u32; - v360 = arith.add v358, v359 : u32 #[overflow = checked]; - v849 = arith.constant 8 : u32; - v362 = arith.mod v360, v849 : u32; - hir.assertz v362 #[code = 250]; - v363 = hir.int_to_ptr v360 : ptr; - hir.store v363, v357; - v364 = arith.constant 16 : i32; - v365 = arith.add v337, v364 : 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::word::Word::reverse(v331, v365) - v848 = arith.constant 32 : i32; - v367 = arith.add v337, v848 : i32 #[overflow = wrapping]; - v368 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v369 = hir.bitcast v368 : ptr; - hir.store v369, v367; + 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; + 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(v370: i32, v371: i32, v372: i32) { - ^block25(v370: i32, v371: i32, v372: i32): - v867, v868, v869 = scf.while v372, v370, v371 : i32, i32, i32 { - ^block28(v374: i32, v381: i32, v385: i32): - v888 = arith.constant 0 : i32; - v373 = arith.constant 0 : i32; - v376 = arith.eq v374, v373 : i1; - v377 = arith.zext v376 : u32; - v378 = hir.bitcast v377 : i32; - v380 = arith.neq v378, v888 : i1; - v882, v883, v884 = scf.if v380 : i32, i32, i32 { + 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: - v860 = ub.poison i32 : i32; - scf.yield v860, v860, v860; + v957 = ub.poison i32 : i32; + scf.yield v957, v957, v957; } else { ^block30: - v382 = hir.bitcast v381 : u32; - v383 = hir.int_to_ptr v382 : ptr; - v384 = hir.load v383 : i32; - v386 = hir.bitcast v385 : u32; - v387 = hir.int_to_ptr v386 : ptr; - v388 = hir.load v387 : i32; - v389 = hir.bitcast v381 : u32; - v390 = hir.int_to_ptr v389 : ptr; - hir.store v390, v388; - v391 = hir.bitcast v385 : u32; - v392 = hir.int_to_ptr v391 : ptr; - hir.store v392, v384; - v887 = arith.constant 4 : i32; - v396 = arith.add v385, v887 : i32 #[overflow = wrapping]; - v395 = arith.constant 4 : i32; - v398 = arith.add v381, v395 : i32 #[overflow = wrapping]; - v393 = arith.constant -1 : i32; - v394 = arith.add v374, v393 : i32 #[overflow = wrapping]; - scf.yield v394, v398, v396; + 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; }; - v859 = arith.constant 1 : u32; - v853 = arith.constant 0 : u32; - v886 = cf.select v380, v853, v859 : u32; - v876 = arith.trunc v886 : i1; - scf.condition v876, v882, v883, v884; + 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(v873: i32, v874: i32, v875: i32): - scf.yield v873, v874, v875; + ^block95(v970: i32, v971: i32, v972: i32): + scf.yield v970, v971, v972; }; builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::advice::adv_insert(v399: i32, v400: i32, v401: i32) { - ^block31(v399: i32, v400: i32, v401: i32): - v403 = arith.constant 12 : u32; - v402 = hir.bitcast v399 : u32; - v404 = arith.add v402, v403 : u32 #[overflow = checked]; - v405 = arith.constant 4 : u32; - v406 = arith.mod v404, v405 : u32; - hir.assertz v406 #[code = 250]; - v407 = hir.int_to_ptr v404 : ptr; - v408 = hir.load v407 : felt; - v410 = arith.constant 8 : u32; - v409 = hir.bitcast v399 : u32; - v411 = arith.add v409, v410 : u32 #[overflow = checked]; - v895 = arith.constant 4 : u32; - v413 = arith.mod v411, v895 : u32; - hir.assertz v413 #[code = 250]; - v414 = hir.int_to_ptr v411 : ptr; - v415 = hir.load v414 : felt; - v894 = arith.constant 4 : u32; - v416 = hir.bitcast v399 : u32; - v418 = arith.add v416, v894 : u32 #[overflow = checked]; - v893 = arith.constant 4 : u32; - v420 = arith.mod v418, v893 : u32; - hir.assertz v420 #[code = 250]; - v421 = hir.int_to_ptr v418 : ptr; - v422 = hir.load v421 : felt; - v423 = hir.bitcast v399 : u32; - v892 = arith.constant 4 : u32; - v425 = arith.mod v423, v892 : u32; - hir.assertz v425 #[code = 250]; - v426 = hir.int_to_ptr v423 : ptr; - v427 = hir.load v426 : felt; - v890 = arith.constant 2 : u32; - v429 = hir.bitcast v400 : u32; - v431 = arith.shr v429, v890 : u32; - v432 = hir.bitcast v431 : i32; - v891 = arith.constant 2 : u32; - v435 = arith.shl v401, v891 : i32; - v436 = arith.add v432, v435 : 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(v408, v415, v422, v427, v432, v436) - builtin.ret ; - }; - - private builtin.function @>::from(v437: i32) -> felt { - ^block33(v437: i32): - v439 = arith.constant 255 : i32; - v440 = arith.band v437, v439 : i32; - v441 = hir.bitcast v440 : felt; - builtin.ret v441; - }; - - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v442: i32, v443: i32) { - ^block35(v442: i32, v443: i32): - v446 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v447 = hir.bitcast v446 : ptr; - v448 = hir.load v447 : i32; - v449 = arith.constant 16 : i32; - v450 = arith.sub v448, v449 : i32 #[overflow = wrapping]; - v452 = arith.constant 8 : u32; - v451 = hir.bitcast v443 : u32; - v453 = arith.add v451, v452 : u32 #[overflow = checked]; - v982 = arith.constant 8 : u32; - v455 = arith.mod v453, v982 : u32; - hir.assertz v455 #[code = 250]; - v456 = hir.int_to_ptr v453 : ptr; - v457 = hir.load v456 : i64; - v981 = arith.constant 8 : u32; - v458 = hir.bitcast v450 : u32; - v460 = arith.add v458, v981 : u32 #[overflow = checked]; - v461 = arith.constant 4 : u32; - v462 = arith.mod v460, v461 : u32; - hir.assertz v462 #[code = 250]; - v463 = hir.int_to_ptr v460 : ptr; - hir.store v463, v457; - v464 = hir.bitcast v443 : u32; - v980 = arith.constant 8 : u32; - v466 = arith.mod v464, v980 : u32; - hir.assertz v466 #[code = 250]; - v467 = hir.int_to_ptr v464 : ptr; - v468 = hir.load v467 : i64; - v469 = hir.bitcast v450 : u32; - v979 = arith.constant 4 : u32; - v471 = arith.mod v469, v979 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - hir.store v472, v468; - v473 = arith.constant 12 : i32; - v474 = arith.add v450, v473 : i32 #[overflow = wrapping]; - v444 = arith.constant 0 : i32; - v950, v951, v952, v953, v954, v955 = scf.while v444, v450, v474, v442 : i32, i32, i32, i32, i32, i32 { - ^block104(v956: i32, v957: i32, v958: i32, v959: i32): - v978 = arith.constant 0 : i32; - v477 = arith.constant 8 : i32; - v478 = arith.eq v956, v477 : i1; - v479 = arith.zext v478 : u32; - v480 = hir.bitcast v479 : i32; - v482 = arith.neq v480, v978 : i1; - v944, v945 = scf.if v482 : i32, i32 { + 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; + 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: - v904 = ub.poison i32 : i32; - scf.yield v904, v904; + v994 = ub.poison i32 : i32; + scf.yield v994, v994; } else { - ^block40: - v484 = arith.add v957, v956 : i32 #[overflow = wrapping]; - v485 = hir.bitcast v484 : u32; - v977 = arith.constant 4 : u32; - v487 = arith.mod v485, v977 : u32; - hir.assertz v487 #[code = 250]; - v488 = hir.int_to_ptr v485 : ptr; - v489 = hir.load v488 : felt; - v491 = hir.bitcast v958 : u32; - v976 = arith.constant 4 : u32; - v493 = arith.mod v491, v976 : u32; - hir.assertz v493 #[code = 250]; - v494 = hir.int_to_ptr v491 : ptr; - v495 = hir.load v494 : i32; - v496 = hir.bitcast v484 : u32; - v975 = arith.constant 4 : u32; - v498 = arith.mod v496, v975 : u32; - hir.assertz v498 #[code = 250]; - v499 = hir.int_to_ptr v496 : ptr; - hir.store v499, v495; - v500 = hir.bitcast v958 : u32; - v974 = arith.constant 4 : u32; - v502 = arith.mod v500, v974 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - hir.store v503, v489; - v506 = arith.constant -4 : i32; - v507 = arith.add v958, v506 : i32 #[overflow = wrapping]; - v504 = arith.constant 4 : i32; - v505 = arith.add v956, v504 : i32 #[overflow = wrapping]; - scf.yield v505, v507; + ^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; }; - v972 = ub.poison i32 : i32; - v947 = cf.select v482, v972, v959 : i32; - v973 = ub.poison i32 : i32; - v946 = cf.select v482, v973, v957 : i32; - v903 = arith.constant 1 : u32; - v896 = arith.constant 0 : u32; - v949 = cf.select v482, v896, v903 : u32; - v937 = arith.trunc v949 : i1; - scf.condition v937, v944, v946, v945, v947, v957, v959; + 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(v960: i32, v961: i32, v962: i32, v963: i32, v964: i32, v965: i32): - scf.yield v960, v961, v962, v963; + ^block105(v1050: i32, v1051: i32, v1052: i32, v1053: i32, v1054: i32, v1055: i32): + scf.yield v1050, v1051, v1052, v1053; }; - v971 = arith.constant 8 : u32; - v509 = hir.bitcast v954 : u32; - v511 = arith.add v509, v971 : u32 #[overflow = checked]; - v970 = arith.constant 4 : u32; - v513 = arith.mod v511, v970 : u32; - hir.assertz v513 #[code = 250]; - v514 = hir.int_to_ptr v511 : ptr; - v515 = hir.load v514 : i64; - v969 = arith.constant 8 : u32; - v516 = hir.bitcast v955 : u32; - v518 = arith.add v516, v969 : u32 #[overflow = checked]; - v968 = arith.constant 8 : u32; - v520 = arith.mod v518, v968 : u32; - hir.assertz v520 #[code = 250]; - v521 = hir.int_to_ptr v518 : ptr; - hir.store v521, v515; - v522 = hir.bitcast v954 : u32; - v967 = arith.constant 4 : u32; - v524 = arith.mod v522, v967 : u32; - hir.assertz v524 #[code = 250]; - v525 = hir.int_to_ptr v522 : ptr; - v526 = hir.load v525 : i64; - v527 = hir.bitcast v955 : u32; - v966 = arith.constant 8 : u32; - v529 = arith.mod v527, v966 : u32; - hir.assertz v529 #[code = 250]; - v530 = hir.int_to_ptr v527 : ptr; - hir.store v530, v526; + 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 @intrinsics::felt::from_u32(v531: i32) -> felt { - ^block41(v531: i32): - v532 = hir.bitcast v531 : felt; - builtin.ret v532; + 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 @intrinsics::felt::assert_eq(v534: felt, v535: felt) { - ^block43(v534: felt, v535: felt): - hir.assert_eq v534, v535; - 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::emit_falcon_sig_to_stack(v536: felt, v537: felt, v538: felt, v539: felt, v540: felt, v541: felt, v542: felt, v543: felt) { - ^block45(v536: felt, v537: felt, v538: felt, v539: felt, v540: felt, v541: felt, v542: felt, v543: felt): - hir.exec @intrinsics/advice/emit_falcon_sig_to_stack(v536, v537, v538, v539, v540, v541, v542, v543) + 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) builtin.ret ; }; - private builtin.function @intrinsics::advice::adv_insert_mem(v544: felt, v545: felt, v546: felt, v547: felt, v548: i32, v549: i32) { - ^block49(v544: felt, v545: felt, v546: felt, v547: felt, v548: i32, v549: i32): - hir.exec @intrinsics/advice/adv_insert_mem(v544, v545, v546, v547, v548, v549) + 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) builtin.ret ; }; - private builtin.function @std::crypto::hashes::rpo::hash_memory_words(v550: i32, v551: i32, v552: i32) { - ^block51(v550: i32, v551: i32, v552: i32): - v553, v554, v555, v556 = hir.exec @std/crypto/hashes/rpo/hash_memory_words(v550, v551) : felt, felt, felt, felt - v557 = hir.bitcast v552 : u32; - v558 = hir.int_to_ptr v557 : ptr; - hir.store v558, v553; - v559 = arith.constant 4 : u32; - v560 = arith.add v557, v559 : u32 #[overflow = checked]; - v561 = hir.int_to_ptr v560 : ptr; - hir.store v561, v554; - v562 = arith.constant 8 : u32; - v563 = arith.add v557, v562 : u32 #[overflow = checked]; - v564 = hir.int_to_ptr v563 : ptr; - hir.store v564, v555; - v565 = arith.constant 12 : u32; - v566 = arith.add v557, v565 : u32 #[overflow = checked]; - v567 = hir.int_to_ptr v566 : ptr; - hir.store v567, v556; + private builtin.function @intrinsics::felt::assert_eq(v627: felt, v628: felt) { + ^block47(v627: felt, v628: felt): + hir.assert_eq v627, v628; builtin.ret ; }; - private builtin.function @std::crypto::dsa::rpo_falcon512::verify(v568: felt, v569: felt, v570: felt, v571: felt, v572: felt, v573: felt, v574: felt, v575: felt) { - ^block57(v568: felt, v569: felt, v570: felt, v571: felt, v572: felt, v573: felt, v574: felt, v575: felt): - hir.exec @std/crypto/dsa/rpo_falcon512/verify(v568, v569, v570, v571, v572, v573, v574, v575) + 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) builtin.ret ; }; - private builtin.function @miden::active_account::get_item(v576: felt, v577: i32) { - ^block61(v576: felt, v577: i32): - v578, v579, v580, v581 = hir.exec @miden/active_account/get_item(v576) : felt, felt, felt, felt - v582 = hir.bitcast v577 : u32; - v583 = hir.int_to_ptr v582 : ptr; - hir.store v583, v578; - v584 = arith.constant 4 : u32; - v585 = arith.add v582, v584 : u32 #[overflow = checked]; - v586 = hir.int_to_ptr v585 : ptr; - hir.store v586, v579; - v587 = arith.constant 8 : u32; - v588 = arith.add v582, v587 : u32 #[overflow = checked]; - v589 = hir.int_to_ptr v588 : ptr; - hir.store v589, v580; - v590 = arith.constant 12 : u32; - v591 = arith.add v582, v590 : u32 #[overflow = checked]; - v592 = hir.int_to_ptr v591 : ptr; - hir.store v592, v581; + 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; builtin.ret ; }; - private builtin.function @miden::native_account::incr_nonce() -> felt { - ^block65: - v593 = hir.exec @miden/native_account/incr_nonce() : felt - builtin.ret v593; + 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; + builtin.ret ; }; - private builtin.function @miden::native_account::compute_delta_commitment(v595: i32) { - ^block68(v595: i32): - v596, v597, v598, v599 = hir.exec @miden/native_account/compute_delta_commitment() : felt, felt, felt, felt - v600 = hir.bitcast v595 : u32; - v601 = hir.int_to_ptr v600 : ptr; - hir.store v601, v596; - v602 = arith.constant 4 : u32; - v603 = arith.add v600, v602 : u32 #[overflow = checked]; - v604 = hir.int_to_ptr v603 : ptr; - hir.store v604, v597; - v605 = arith.constant 8 : u32; - v606 = arith.add v600, v605 : u32 #[overflow = checked]; - v607 = hir.int_to_ptr v606 : ptr; - hir.store v607, v598; - v608 = arith.constant 12 : u32; - v609 = arith.add v600, v608 : u32 #[overflow = checked]; - v610 = hir.int_to_ptr v609 : ptr; - hir.store v610, v599; + 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; 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::tx::get_block_number() -> felt { ^block70: - v611 = hir.exec @miden/tx/get_block_number() : felt - builtin.ret v611; + v693 = hir.exec @miden/tx/get_block_number() : felt + builtin.ret v693; }; - private builtin.function @miden::tx::get_input_notes_commitment(v613: i32) { - ^block73(v613: i32): - v614, v615, v616, v617 = hir.exec @miden/tx/get_input_notes_commitment() : felt, felt, felt, felt - v618 = hir.bitcast v613 : u32; - v619 = hir.int_to_ptr v618 : ptr; - hir.store v619, v614; - v620 = arith.constant 4 : u32; - v621 = arith.add v618, v620 : u32 #[overflow = checked]; - v622 = hir.int_to_ptr v621 : ptr; - hir.store v622, v615; - v623 = arith.constant 8 : u32; - v624 = arith.add v618, v623 : u32 #[overflow = checked]; - v625 = hir.int_to_ptr v624 : ptr; - hir.store v625, v616; - v626 = arith.constant 12 : u32; - v627 = arith.add v618, v626 : u32 #[overflow = checked]; - v628 = hir.int_to_ptr v627 : ptr; - hir.store v628, v617; + 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; builtin.ret ; }; - private builtin.function @miden::tx::get_output_notes_commitment(v629: i32) { - ^block75(v629: i32): - v630, v631, v632, v633 = hir.exec @miden/tx/get_output_notes_commitment() : felt, felt, felt, felt - v634 = hir.bitcast v629 : u32; - v635 = hir.int_to_ptr v634 : ptr; - hir.store v635, v630; - v636 = arith.constant 4 : u32; - v637 = arith.add v634, v636 : u32 #[overflow = checked]; - v638 = hir.int_to_ptr v637 : ptr; - hir.store v638, v631; - v639 = arith.constant 8 : u32; - v640 = arith.add v634, v639 : u32 #[overflow = checked]; - v641 = hir.int_to_ptr v640 : ptr; - hir.store v641, v632; - v642 = arith.constant 12 : u32; - v643 = arith.add v634, v642 : u32 #[overflow = checked]; - v644 = hir.int_to_ptr v643 : ptr; - hir.store v644, v633; + 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; builtin.ret ; }; @@ -879,9 +979,9 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @auth__procedure(v645: felt, v646: felt, v647: felt, v648: felt) { - ^block77(v645: felt, v646: felt, v647: felt, v648: 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(v645, v646, v647, v648) + 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) 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 a4ac9bdad..590535035 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm @@ -67,7 +67,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_sw trace.252 nop - push.112 + push.160 u32wrapping_sub push.1114144 dup.1 @@ -94,7 +94,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::native_account::incr_nonce trace.252 nop - push.80 + push.144 dup.3 u32wrapping_add trace.240 @@ -102,7 +102,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::native_account::compute_delta_commitment trace.252 nop - push.88 + push.152 dup.3 add u32assert @@ -120,7 +120,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.104 + push.56 dup.5 add u32assert @@ -139,7 +139,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.80 + push.144 dup.3 add u32assert @@ -157,7 +157,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.96 + push.48 dup.5 add u32assert @@ -176,13 +176,13 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.96 + push.48 dup.3 u32wrapping_add dup.3 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse trace.252 nop push.16 @@ -213,7 +213,224 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 trace.252 nop - push.60 + push.24 + dup.5 + 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.72 + dup.7 + u32wrapping_add + 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.40 + dup.5 + 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.88 + dup.7 + u32wrapping_add + 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.8 + dup.5 + 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.56 + dup.7 + 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 + dup.4 + 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.48 + dup.7 + 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.5 + 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.64 + dup.7 + 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.5 + 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.80 + dup.7 + 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.108 dup.5 add u32assert @@ -232,7 +449,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.56 + push.104 dup.4 add u32assert @@ -251,7 +468,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.52 + push.100 dup.3 add u32assert @@ -268,7 +485,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.48 + push.96 dup.2 add u32assert @@ -304,10 +521,12 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop push.2 - dup.1 + push.48 + dup.2 + u32wrapping_add swap.1 u32shr - push.80 + push.128 dup.2 u32wrapping_add push.16 @@ -319,7 +538,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- 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.88 + push.136 dup.1 add u32assert @@ -337,7 +556,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.104 + push.152 dup.3 add u32assert @@ -356,7 +575,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.80 + push.128 dup.1 add u32assert @@ -374,7 +593,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.96 + push.144 dup.3 add u32assert @@ -393,18 +612,18 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.96 + push.144 dup.1 u32wrapping_add - push.64 + push.112 dup.2 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::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse trace.252 nop - push.64 + push.112 dup.1 add u32assert @@ -421,7 +640,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.68 + push.116 dup.2 add u32assert @@ -438,7 +657,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.72 + push.120 dup.3 add u32assert @@ -455,7 +674,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.76 + push.124 dup.4 add u32assert @@ -472,7 +691,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.48 + push.96 dup.5 u32wrapping_add push.0 @@ -495,14 +714,16 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- dup.0 else push.4 - dup.3 + push.48 + dup.4 + u32wrapping_add dup.3 u32wrapping_add dup.5 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 + 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> trace.252 nop push.4294967280 @@ -580,7 +801,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- drop drop drop - push.108 + push.156 dup.1 add u32assert @@ -599,7 +820,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.104 + push.152 dup.1 add u32assert @@ -618,7 +839,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.100 + push.148 dup.1 add u32assert @@ -637,7 +858,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.96 + push.144 dup.1 add u32assert @@ -657,11 +878,12 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop push.4 - push.96 + push.48 dup.2 u32wrapping_add - dup.2 - swap.1 + push.144 + 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_stdlib_sys::intrinsics::advice::adv_insert @@ -673,7 +895,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::>::from trace.252 nop - push.80 + push.128 dup.2 u32wrapping_add swap.1 @@ -682,7 +904,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::active_account::get_item trace.252 nop - push.88 + push.136 dup.1 add u32assert @@ -700,7 +922,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.104 + push.152 dup.3 add u32assert @@ -719,7 +941,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.80 + push.128 dup.1 add u32assert @@ -737,7 +959,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.96 + push.144 dup.3 add u32assert @@ -756,18 +978,18 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.96 + push.144 dup.1 u32wrapping_add - push.64 + push.112 dup.2 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::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse trace.252 nop - push.76 + push.124 dup.1 add u32assert @@ -784,7 +1006,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.72 + push.120 dup.2 add u32assert @@ -801,7 +1023,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.68 + push.116 dup.3 add u32assert @@ -818,7 +1040,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.64 + push.112 dup.4 add u32assert @@ -863,7 +1085,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::std::crypto::dsa::rpo_falcon512::verify trace.252 nop - push.112 + push.160 u32wrapping_add push.1114144 u32divmod.4 @@ -1067,7 +1289,7 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( movup.2 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse trace.252 nop push.32 @@ -1189,7 +1411,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( movup.2 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse trace.252 nop push.32 @@ -1205,7 +1427,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( end @callconv("C") -proc core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks( +proc core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4>( i32, i32, i32 @@ -1289,110 +1511,7 @@ proc core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks( end @callconv("C") -proc miden_stdlib_sys::intrinsics::advice::adv_insert( - i32, - i32, - i32 -) - 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_felt - trace.252 - nop - 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_felt - trace.252 - nop - push.4 - dup.3 - 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 - movup.3 - 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 - movup.5 - swap.1 - u32shr - push.2 - movup.6 - swap.1 - u32shl - dup.1 - u32wrapping_add - movup.2 - swap.3 - movdn.2 - swap.1 - swap.4 - swap.1 - 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 - trace.252 - nop -end - -@callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -1669,13 +1788,115 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt +proc miden_stdlib_sys::intrinsics::advice::adv_insert( + i32, + i32, + i32 +) + 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_felt + trace.252 + nop + 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_felt + trace.252 + nop + push.4 + dup.3 + 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 + movup.3 + 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 + movup.5 + swap.1 + u32shr + push.2 + movup.6 + swap.1 + u32shl + dup.1 + u32wrapping_add + movup.2 + swap.3 + movdn.2 + swap.1 + swap.4 + swap.1 + 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 + trace.252 nop end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq +proc >::from( + i32 +) -> felt + push.255 + u32and +end + +@callconv("C") +proc intrinsics::advice::adv_insert_mem(felt, felt, felt, felt, i32, i32) + trace.240 + nop + exec.::intrinsics::advice::adv_insert_mem + trace.252 + nop end @callconv("C") @@ -1697,10 +1918,29 @@ proc intrinsics::advice::emit_falcon_sig_to_stack( end @callconv("C") -proc intrinsics::advice::adv_insert_mem(felt, felt, felt, felt, i32, i32) +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( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) trace.240 nop - exec.::intrinsics::advice::adv_insert_mem + exec.::std::crypto::dsa::rpo_falcon512::verify trace.252 nop end @@ -1761,24 +2001,6 @@ proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) nop end -@callconv("C") -proc std::crypto::dsa::rpo_falcon512::verify( - felt, - felt, - felt, - felt, - felt, - felt, - felt, - felt -) - trace.240 - nop - exec.::std::crypto::dsa::rpo_falcon512::verify - trace.252 - nop -end - @callconv("C") proc miden::active_account::get_item(felt, i32) trace.240 @@ -1835,17 +2057,6 @@ proc miden::active_account::get_item(felt, i32) nop end -@callconv("C") -proc miden::native_account::incr_nonce( - -) -> felt - trace.240 - nop - exec.::miden::native_account::incr_nonce - trace.252 - nop -end - @callconv("C") proc miden::native_account::compute_delta_commitment(i32) trace.240 @@ -1902,6 +2113,17 @@ proc miden::native_account::compute_delta_commitment(i32) nop end +@callconv("C") +proc miden::native_account::incr_nonce( + +) -> felt + trace.240 + nop + exec.::miden::native_account::incr_nonce + trace.252 + nop +end + @callconv("C") proc miden::tx::get_block_number( diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat index ebb1b523d..691eae441 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,18 +8,18 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (result f32))) (type (;3;) (func (param i32))) (type (;4;) (func (param i32 i32 i32))) - (type (;5;) (func (param i32) (result f32))) - (type (;6;) (func (param i32 i32))) - (type (;7;) (func (param f32 f32))) + (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 f32 f32 i32 i32))) + (type (;9;) (func (param f32 f32))) (type (;10;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -33,7 +33,7 @@ (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) global.get $__stack_pointer - i32.const 112 + i32.const 160 i32.sub local.tee 4 global.set $__stack_pointer @@ -43,22 +43,22 @@ call $miden::native_account::incr_nonce local.set 6 local.get 4 - i32.const 80 + i32.const 144 i32.add call $miden::native_account::compute_delta_commitment local.get 4 local.get 4 - i64.load offset=88 - i64.store offset=104 + i64.load offset=152 + i64.store offset=56 local.get 4 local.get 4 - i64.load offset=80 - i64.store offset=96 + i64.load offset=144 + i64.store offset=48 local.get 4 local.get 4 - i32.const 96 + i32.const 48 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 4 i32.const 16 i32.add @@ -76,23 +76,53 @@ call $intrinsics::felt::from_u32 local.set 9 local.get 4 + i32.const 72 + i32.add + local.get 4 + i64.load offset=24 + i64.store + local.get 4 + i32.const 88 + i32.add + local.get 4 + i64.load offset=40 + i64.store + local.get 4 + local.get 4 + i64.load offset=8 + i64.store offset=56 + local.get 4 + local.get 4 + i64.load + i64.store offset=48 + local.get 4 + local.get 4 + i64.load offset=16 + i64.store offset=64 + local.get 4 + local.get 4 + i64.load offset=32 + i64.store offset=80 + local.get 4 local.get 6 - f32.store offset=60 + f32.store offset=108 local.get 4 local.get 5 - f32.store offset=56 + f32.store offset=104 local.get 4 local.get 9 - f32.store offset=52 + f32.store offset=100 local.get 4 local.get 8 - f32.store offset=48 + f32.store offset=96 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.add i32.const 2 i32.shr_u local.tee 10 @@ -100,38 +130,38 @@ i32.const 16 i32.add local.get 4 - i32.const 80 + i32.const 128 i32.add call $std::crypto::hashes::rpo::hash_memory_words local.get 4 local.get 4 - i64.load offset=88 - i64.store offset=104 + i64.load offset=136 + i64.store offset=152 local.get 4 local.get 4 - i64.load offset=80 - i64.store offset=96 + i64.load offset=128 + i64.store offset=144 local.get 4 - i32.const 64 + i32.const 112 i32.add local.get 4 - i32.const 96 + i32.const 144 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 4 - f32.load offset=64 + f32.load offset=112 local.set 5 local.get 4 - f32.load offset=68 + f32.load offset=116 local.set 6 local.get 4 - f32.load offset=72 + f32.load offset=120 local.set 8 local.get 4 - f32.load offset=76 + f32.load offset=124 local.set 9 local.get 4 - i32.const 48 + i32.const 96 i32.add local.set 10 block ;; label = @1 @@ -141,11 +171,13 @@ i32.eq br_if 1 (;@1;) local.get 4 + i32.const 48 + i32.add local.get 7 i32.add local.get 10 i32.const 4 - call $core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks + call $core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4> local.get 7 i32.const 16 i32.add @@ -159,58 +191,60 @@ end local.get 4 local.get 9 - f32.store offset=108 + f32.store offset=156 local.get 4 local.get 8 - f32.store offset=104 + f32.store offset=152 local.get 4 local.get 6 - f32.store offset=100 + f32.store offset=148 local.get 4 local.get 5 - f32.store offset=96 + f32.store offset=144 local.get 4 - i32.const 96 + i32.const 144 i32.add local.get 4 + i32.const 48 + i32.add i32.const 4 call $miden_stdlib_sys::intrinsics::advice::adv_insert i32.const 0 call $>::from local.get 4 - i32.const 80 + i32.const 128 i32.add call $miden::active_account::get_item local.get 4 local.get 4 - i64.load offset=88 - i64.store offset=104 + i64.load offset=136 + i64.store offset=152 local.get 4 local.get 4 - i64.load offset=80 - i64.store offset=96 + i64.load offset=128 + i64.store offset=144 local.get 4 - i32.const 64 + i32.const 112 i32.add local.get 4 - i32.const 96 + i32.const 144 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 9 local.get 8 local.get 6 local.get 5 local.get 4 - f32.load offset=76 + f32.load offset=124 local.tee 11 local.get 4 - f32.load offset=72 + f32.load offset=120 local.tee 12 local.get 4 - f32.load offset=68 + f32.load offset=116 local.tee 13 local.get 4 - f32.load offset=64 + f32.load offset=112 local.tee 14 call $intrinsics::advice::emit_falcon_sig_to_stack local.get 11 @@ -223,7 +257,7 @@ local.get 5 call $std::crypto::dsa::rpo_falcon512::verify local.get 4 - i32.const 112 + i32.const 160 i32.add global.set $__stack_pointer ) @@ -269,7 +303,7 @@ local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 32 i32.add @@ -296,13 +330,13 @@ local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 32 i32.add global.set $__stack_pointer ) - (func $core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks (;7;) (type 4) (param i32 i32 i32) + (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 @@ -335,33 +369,7 @@ end end ) - (func $miden_stdlib_sys::intrinsics::advice::adv_insert (;8;) (type 4) (param i32 i32 i32) - local.get 0 - f32.load offset=12 - local.get 0 - f32.load offset=8 - local.get 0 - f32.load offset=4 - local.get 0 - f32.load - local.get 1 - i32.const 2 - i32.shr_u - local.tee 0 - local.get 0 - local.get 2 - i32.const 2 - i32.shl - i32.add - call $intrinsics::advice::adv_insert_mem - ) - (func $>::from (;9;) (type 5) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;10;) (type 6) (param i32 i32) + (func $::reverse (;8;) (type 5) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -419,31 +427,57 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;11;) (type 5) (param i32) (result f32) + (func $miden_stdlib_sys::intrinsics::advice::adv_insert (;9;) (type 4) (param i32 i32 i32) + local.get 0 + f32.load offset=12 + local.get 0 + f32.load offset=8 + local.get 0 + f32.load offset=4 + local.get 0 + f32.load + local.get 1 + i32.const 2 + i32.shr_u + local.tee 0 + local.get 0 + local.get 2 + i32.const 2 + i32.shl + 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 (;11;) (type 7) (param f32 f32 f32 f32 i32 i32) unreachable ) - (func $intrinsics::felt::assert_eq (;12;) (type 7) (param f32 f32) + (func $intrinsics::advice::emit_falcon_sig_to_stack (;12;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) unreachable ) - (func $intrinsics::advice::emit_falcon_sig_to_stack (;13;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) + (func $intrinsics::felt::assert_eq (;13;) (type 9) (param f32 f32) unreachable ) - (func $intrinsics::advice::adv_insert_mem (;14;) (type 9) (param f32 f32 f32 f32 i32 i32) + (func $intrinsics::felt::from_u32 (;14;) (type 6) (param i32) (result f32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory_words (;15;) (type 4) (param i32 i32 i32) + (func $std::crypto::dsa::rpo_falcon512::verify (;15;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) unreachable ) - (func $std::crypto::dsa::rpo_falcon512::verify (;16;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) + (func $std::crypto::hashes::rpo::hash_memory_words (;16;) (type 4) (param i32 i32 i32) unreachable ) (func $miden::active_account::get_item (;17;) (type 10) (param f32 i32) unreachable ) - (func $miden::native_account::incr_nonce (;18;) (type 2) (result f32) + (func $miden::native_account::compute_delta_commitment (;18;) (type 3) (param i32) unreachable ) - (func $miden::native_account::compute_delta_commitment (;19;) (type 3) (param i32) + (func $miden::native_account::incr_nonce (;19;) (type 2) (result f32) unreachable ) (func $miden::tx::get_block_number (;20;) (type 2) (result f32) @@ -458,15 +492,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure" (core func $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure (;0;))) + (func $auth-procedure (;0;) (type 2) (canon lift (core func $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -479,12 +513,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "auth-procedure" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-auth-procedure" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0-shim-instance (;1;) (instantiate $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0-shim-component + (with "import-func-auth-procedure" (func $auth-procedure)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0" (instance 1)) + (export $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0 (;2;) "miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0" (instance $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0-shim-instance)) ) diff --git a/tests/integration/expected/examples/basic_wallet.hir b/tests/integration/expected/examples/basic_wallet.hir index 73cf07072..5c9789f2e 100644 --- a/tests/integration/expected/examples/basic_wallet.hir +++ b/tests/integration/expected/examples/basic_wallet.hir @@ -10,107 +10,107 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret ; }; - private builtin.function @miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v0: felt, v1: felt, v2: felt, v3: felt) { - ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - 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; - v8 = arith.constant 32 : i32; - v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; - 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; + 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.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/wit_bindgen::rt::run_ctors_once() - v13 = arith.constant 12 : u32; - v12 = hir.bitcast v9 : 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; - hir.store v17, v3; - v19 = arith.constant 8 : u32; - v18 = hir.bitcast v9 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; + 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; - v22 = arith.mod v20, v375 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v2; + v25 = hir.bitcast v10 : u32; + v27 = arith.add v25, v375 : u32 #[overflow = checked]; v374 = arith.constant 4 : u32; - v24 = hir.bitcast v9 : u32; - v26 = arith.add v24, v374 : u32 #[overflow = checked]; + 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; - v28 = arith.mod v26, v373 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - hir.store v29, v1; - v30 = hir.bitcast v9 : u32; - v372 = arith.constant 4 : u32; - v32 = arith.mod v30, v372 : u32; - hir.assertz v32 #[code = 250]; - v33 = hir.int_to_ptr v30 : ptr; - hir.store v33, v0; - v34 = arith.constant 16 : i32; - v35 = arith.add v9, v34 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::add_asset(v35, v9) + 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; - v37 = arith.add v9, v371 : i32 #[overflow = wrapping]; - v38 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v39 = hir.bitcast v38 : ptr; - hir.store v39, v37; + 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#move-asset-to-note(v40: felt, v41: felt, v42: felt, v43: felt, v44: felt) { - ^block11(v40: felt, v41: felt, v42: felt, v43: felt, v44: felt): - v46 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v47 = hir.bitcast v46 : ptr; - v48 = hir.load v47 : i32; - v49 = arith.constant 32 : i32; - v50 = arith.sub v48, v49 : i32 #[overflow = wrapping]; - v51 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v52 = hir.bitcast v51 : ptr; - hir.store v52, v50; + 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]; + 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; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/wit_bindgen::rt::run_ctors_once() - v54 = arith.constant 12 : u32; - v53 = hir.bitcast v50 : 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; - hir.store v58, v43; - v60 = arith.constant 8 : u32; - v59 = hir.bitcast v50 : u32; - v61 = arith.add v59, v60 : u32 #[overflow = checked]; + 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; - v63 = arith.mod v61, v381 : u32; - hir.assertz v63 #[code = 250]; - v64 = hir.int_to_ptr v61 : ptr; - hir.store v64, v42; + 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; - v65 = hir.bitcast v50 : u32; - v67 = arith.add v65, v380 : u32 #[overflow = checked]; + v67 = hir.bitcast v52 : u32; + v69 = arith.add v67, v380 : u32 #[overflow = checked]; v379 = arith.constant 4 : u32; - v69 = arith.mod v67, v379 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - hir.store v70, v41; - v71 = hir.bitcast v50 : 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; - v73 = arith.mod v71, v378 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - hir.store v74, v40; - v75 = arith.constant 16 : i32; - v76 = arith.add v50, v75 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::remove_asset(v76, v50) - v377 = arith.constant 16 : i32; - v78 = arith.add v50, v377 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::output_note::add_asset(v78, v44) - v376 = arith.constant 32 : i32; - v80 = arith.add v50, v376 : i32 #[overflow = wrapping]; + 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; @@ -151,10 +151,10 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::native_account::add_asset(v106: i32, v107: i32) { - ^block17(v106: i32, v107: i32): + 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 v107 : 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; @@ -162,7 +162,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v113 = hir.int_to_ptr v110 : ptr; v114 = hir.load v113 : felt; v116 = arith.constant 8 : u32; - v115 = hir.bitcast v107 : 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; @@ -170,20 +170,20 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v120 = hir.int_to_ptr v117 : ptr; v121 = hir.load v120 : felt; v388 = arith.constant 4 : u32; - v122 = hir.bitcast v107 : 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 v107 : u32; + 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::native_account::add_asset(v114, v121, v128, v133, v106) + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::output_note::add_asset(v114, v121, v128, v133, v107) builtin.ret ; }; @@ -260,7 +260,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v134, v195) + 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 @@ -269,10 +269,10 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::add_asset(v200: i32, v201: felt) { - ^block21(v200: i32, v201: felt): + 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 v200 : 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; @@ -280,7 +280,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v207 = hir.int_to_ptr v204 : ptr; v208 = hir.load v207 : felt; v210 = arith.constant 8 : u32; - v209 = hir.bitcast v200 : 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; @@ -288,24 +288,24 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v214 = hir.int_to_ptr v211 : ptr; v215 = hir.load v214 : felt; v402 = arith.constant 4 : u32; - v216 = hir.bitcast v200 : 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 v200 : u32; + 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::output_note::add_asset(v208, v215, v222, v227, v201) + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::native_account::add_asset(v208, v215, v222, v227, v200) builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v228: i32, v229: i32) { + 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; @@ -432,51 +432,51 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret ; }; - private builtin.function @miden::output_note::add_asset(v317: felt, v318: felt, v319: felt, v320: felt, v321: felt) { - ^block29(v317: felt, v318: felt, v319: felt, v320: felt, v321: felt): - hir.exec @miden/output_note/add_asset(v317, v318, v319, v320, v321) + 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; builtin.ret ; }; - private builtin.function @miden::native_account::add_asset(v322: felt, v323: felt, v324: felt, v325: felt, v326: i32) { - ^block33(v322: felt, v323: felt, v324: felt, v325: felt, v326: i32): - v327, v328, v329, v330 = hir.exec @miden/native_account/add_asset(v322, v323, v324, v325) : felt, felt, felt, felt - v331 = hir.bitcast v326 : u32; - v332 = hir.int_to_ptr v331 : ptr; - hir.store v332, v327; - v333 = arith.constant 4 : u32; - v334 = arith.add v331, v333 : u32 #[overflow = checked]; - v335 = hir.int_to_ptr v334 : ptr; - hir.store v335, v328; - v336 = arith.constant 8 : u32; - v337 = arith.add v331, v336 : u32 #[overflow = checked]; - v338 = hir.int_to_ptr v337 : ptr; - hir.store v338, v329; - v339 = arith.constant 12 : u32; - v340 = arith.add v331, v339 : u32 #[overflow = checked]; - v341 = hir.int_to_ptr v340 : ptr; - hir.store v341, v330; + 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; builtin.ret ; }; - private builtin.function @miden::native_account::remove_asset(v342: felt, v343: felt, v344: felt, v345: felt, v346: i32) { - ^block36(v342: felt, v343: felt, v344: felt, v345: felt, v346: i32): - v347, v348, v349, v350 = hir.exec @miden/native_account/remove_asset(v342, v343, v344, v345) : felt, felt, felt, felt - v351 = hir.bitcast v346 : u32; - v352 = hir.int_to_ptr v351 : ptr; - hir.store v352, v347; - v353 = arith.constant 4 : u32; - v354 = arith.add v351, v353 : u32 #[overflow = checked]; - v355 = hir.int_to_ptr v354 : ptr; - hir.store v355, v348; - v356 = arith.constant 8 : u32; - v357 = arith.add v351, v356 : u32 #[overflow = checked]; - v358 = hir.int_to_ptr v357 : ptr; - hir.store v358, v349; - v359 = arith.constant 12 : u32; - v360 = arith.add v351, v359 : u32 #[overflow = checked]; - v361 = hir.int_to_ptr v360 : ptr; - hir.store v361, v350; + 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) builtin.ret ; }; diff --git a/tests/integration/expected/examples/basic_wallet.masm b/tests/integration/expected/examples/basic_wallet.masm index e216fd157..e97f30a45 100644 --- a/tests/integration/expected/examples/basic_wallet.masm +++ b/tests/integration/expected/examples/basic_wallet.masm @@ -60,7 +60,13 @@ proc basic_wallet::bindings::__link_custom_section_describing_imports( end @callconv("C") -proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) +proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( + felt, + felt, + felt, + felt, + felt +) push.1114144 u32divmod.4 swap.1 @@ -166,7 +172,17 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) 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.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::native_account::remove_asset + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + swap.1 + 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 push.32 @@ -182,13 +198,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) end @callconv("C") -proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( - felt, - felt, - felt, - felt, - felt -) +proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) push.1114144 u32divmod.4 swap.1 @@ -294,17 +304,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( swap.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 - push.16 - dup.1 - u32wrapping_add - movup.2 - 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.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::native_account::add_asset trace.252 nop push.32 @@ -394,12 +394,12 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_base_sys::bindings::native_account::add_asset( +proc miden_base_sys::bindings::output_note::add_asset( i32, - i32 + felt ) push.12 - dup.2 + dup.1 add u32assert push.4 @@ -416,7 +416,7 @@ proc miden_base_sys::bindings::native_account::add_asset( trace.252 nop push.8 - dup.3 + dup.2 add u32assert push.4 @@ -433,7 +433,7 @@ proc miden_base_sys::bindings::native_account::add_asset( trace.252 nop push.4 - dup.4 + dup.3 add u32assert push.4 @@ -449,7 +449,7 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 + movup.3 push.4 dup.1 swap.1 @@ -467,7 +467,7 @@ proc miden_base_sys::bindings::native_account::add_asset( swap.2 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::native_account::add_asset + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::output_note::add_asset trace.252 nop end @@ -649,7 +649,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( movup.2 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::::reverse trace.252 nop push.32 @@ -665,12 +665,12 @@ proc miden_base_sys::bindings::native_account::remove_asset( end @callconv("C") -proc miden_base_sys::bindings::output_note::add_asset( +proc miden_base_sys::bindings::native_account::add_asset( i32, - felt + i32 ) push.12 - dup.1 + dup.2 add u32assert push.4 @@ -687,7 +687,7 @@ proc miden_base_sys::bindings::output_note::add_asset( trace.252 nop push.8 - dup.2 + dup.3 add u32assert push.4 @@ -704,7 +704,7 @@ proc miden_base_sys::bindings::output_note::add_asset( trace.252 nop push.4 - dup.3 + dup.4 add u32assert push.4 @@ -720,7 +720,7 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + movup.4 push.4 dup.1 swap.1 @@ -738,13 +738,13 @@ 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::native_account::add_asset trace.252 nop end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -1020,15 +1020,6 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( nop end -@callconv("C") -proc miden::output_note::add_asset(felt, felt, felt, felt, felt) - trace.240 - nop - exec.::miden::output_note::add_asset - trace.252 - nop -end - @callconv("C") proc miden::native_account::add_asset(felt, felt, felt, felt, i32) trace.240 @@ -1141,3 +1132,12 @@ proc miden::native_account::remove_asset(felt, felt, felt, felt, i32) nop end +@callconv("C") +proc miden::output_note::add_asset(felt, felt, felt, felt, felt) + trace.240 + nop + exec.::miden::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 4fa434af9..4969facfe 100644 --- a/tests/integration/expected/examples/basic_wallet.wat +++ b/tests/integration/expected/examples/basic_wallet.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -12,85 +12,85 @@ (export (;8;) "note-idx" (type (eq 7))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) - (type (;2;) (func (param f32 f32 f32 f32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32 f32))) + (type (;1;) (func (param f32 f32 f32 f32 f32))) + (type (;2;) (func (param f32 f32 f32 f32))) + (type (;3;) (func (param i32 f32))) + (type (;4;) (func (param i32 i32))) (type (;5;) (func (param f32 f32 f32 f32 i32))) (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:basic-wallet/basic-wallet@0.1.0#receive-asset" (func $miden:basic-wallet/basic-wallet@0.1.0#receive-asset)) (export "miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note" (func $miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note)) + (export "miden:basic-wallet/basic-wallet@0.1.0#receive-asset" (func $miden:basic-wallet/basic-wallet@0.1.0#receive-asset)) (elem (;0;) (i32.const 1) func $basic_wallet::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $basic_wallet::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:basic-wallet/basic-wallet@0.1.0#receive-asset (;2;) (type 1) (param f32 f32 f32 f32) + (func $miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note (;2;) (type 1) (param f32 f32 f32 f32 f32) (local i32) global.get $__stack_pointer i32.const 32 i32.sub - local.tee 4 + local.tee 5 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - local.get 4 + local.get 5 local.get 3 f32.store offset=12 - local.get 4 + local.get 5 local.get 2 f32.store offset=8 - local.get 4 + local.get 5 local.get 1 f32.store offset=4 - local.get 4 + local.get 5 local.get 0 f32.store - local.get 4 + local.get 5 + i32.const 16 + i32.add + local.get 5 + call $miden_base_sys::bindings::native_account::remove_asset + local.get 5 i32.const 16 i32.add local.get 4 - call $miden_base_sys::bindings::native_account::add_asset - local.get 4 + call $miden_base_sys::bindings::output_note::add_asset + local.get 5 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note (;3;) (type 2) (param f32 f32 f32 f32 f32) + (func $miden:basic-wallet/basic-wallet@0.1.0#receive-asset (;3;) (type 2) (param f32 f32 f32 f32) (local i32) global.get $__stack_pointer i32.const 32 i32.sub - local.tee 5 + local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - local.get 5 + local.get 4 local.get 3 f32.store offset=12 - local.get 5 + local.get 4 local.get 2 f32.store offset=8 - local.get 5 + local.get 4 local.get 1 f32.store offset=4 - local.get 5 + local.get 4 local.get 0 f32.store - local.get 5 - i32.const 16 - i32.add - local.get 5 - call $miden_base_sys::bindings::native_account::remove_asset - local.get 5 + local.get 4 i32.const 16 i32.add local.get 4 - call $miden_base_sys::bindings::output_note::add_asset - local.get 5 + call $miden_base_sys::bindings::native_account::add_asset + local.get 4 i32.const 32 i32.add global.set $__stack_pointer @@ -113,19 +113,19 @@ i32.store8 end ) - (func $miden_base_sys::bindings::native_account::add_asset (;5;) (type 3) (param i32 i32) - local.get 1 + (func $miden_base_sys::bindings::output_note::add_asset (;5;) (type 3) (param i32 f32) + local.get 0 f32.load offset=12 - local.get 1 + local.get 0 f32.load offset=8 - local.get 1 + local.get 0 f32.load offset=4 - local.get 1 - f32.load local.get 0 - call $miden::native_account::add_asset + f32.load + local.get 1 + call $miden::output_note::add_asset ) - (func $miden_base_sys::bindings::native_account::remove_asset (;6;) (type 3) (param i32 i32) + (func $miden_base_sys::bindings::native_account::remove_asset (;6;) (type 4) (param i32 i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -154,25 +154,25 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::output_note::add_asset (;7;) (type 4) (param i32 f32) - local.get 0 + (func $miden_base_sys::bindings::native_account::add_asset (;7;) (type 4) (param i32 i32) + local.get 1 f32.load offset=12 - local.get 0 + local.get 1 f32.load offset=8 - local.get 0 + local.get 1 f32.load offset=4 - local.get 0 - f32.load local.get 1 - call $miden::output_note::add_asset + f32.load + local.get 0 + call $miden::native_account::add_asset ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;8;) (type 3) (param i32 i32) + (func $::reverse (;8;) (type 4) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -230,33 +230,33 @@ i64.load align=4 i64.store ) - (func $miden::output_note::add_asset (;9;) (type 2) (param f32 f32 f32 f32 f32) + (func $miden::native_account::add_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::native_account::add_asset (;10;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::native_account::remove_asset (;10;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::native_account::remove_asset (;11;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::output_note::add_asset (;11;) (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") ) - (alias export 0 "asset" (type (;1;))) - (alias export 0 "note-idx" (type (;2;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;3;) (func (param "asset" 1))) - (alias core export 0 "miden:basic-wallet/basic-wallet@0.1.0#receive-asset" (core func (;0;))) - (func (;0;) (type 3) (canon lift (core func 0))) - (type (;4;) (func (param "asset" 1) (param "note-idx" 2))) - (alias core export 0 "miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note" (core func (;1;))) - (func (;1;) (type 4) (canon lift (core func 1))) - (alias export 0 "felt" (type (;5;))) - (alias export 0 "word" (type (;6;))) - (alias export 0 "asset" (type (;7;))) - (alias export 0 "note-idx" (type (;8;))) - (component (;0;) + (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;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;3;) (func (param "asset" $asset))) + (alias core export $main "miden:basic-wallet/basic-wallet@0.1.0#receive-asset" (core func $miden:basic-wallet/basic-wallet@0.1.0#receive-asset (;0;))) + (func $receive-asset (;0;) (type 3) (canon lift (core func $miden:basic-wallet/basic-wallet@0.1.0#receive-asset))) + (type (;4;) (func (param "asset" $asset) (param "note-idx" $note-idx))) + (alias core export $main "miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note" (core func $miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note (;1;))) + (func $move-asset-to-note (;1;) (type 4) (canon lift (core func $miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;5;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;6;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type7 asset" (@name "asset") (;7;))) + (alias export $miden:base/core-types@1.0.0 "note-idx" (type $"#type8 note-idx" (@name "note-idx") (;8;))) + (component $miden:basic-wallet/basic-wallet@0.1.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -279,16 +279,16 @@ (type (;16;) (func (param "asset" 13) (param "note-idx" 14))) (export (;3;) "move-asset-to-note" (func 1) (func (type 16))) ) - (instance (;1;) (instantiate 0 - (with "import-func-receive-asset" (func 0)) - (with "import-func-move-asset-to-note" (func 1)) - (with "import-type-felt" (type 5)) - (with "import-type-word" (type 6)) - (with "import-type-asset" (type 7)) - (with "import-type-note-idx" (type 8)) - (with "import-type-asset0" (type 1)) - (with "import-type-note-idx0" (type 2)) + (instance $miden:basic-wallet/basic-wallet@0.1.0-shim-instance (;1;) (instantiate $miden:basic-wallet/basic-wallet@0.1.0-shim-component + (with "import-func-receive-asset" (func $receive-asset)) + (with "import-func-move-asset-to-note" (func $move-asset-to-note)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-asset" (type $"#type7 asset")) + (with "import-type-note-idx" (type $"#type8 note-idx")) + (with "import-type-asset0" (type $asset)) + (with "import-type-note-idx0" (type $note-idx)) ) ) - (export (;2;) "miden:basic-wallet/basic-wallet@0.1.0" (instance 1)) + (export $miden:basic-wallet/basic-wallet@0.1.0 (;2;) "miden:basic-wallet/basic-wallet@0.1.0" (instance $miden:basic-wallet/basic-wallet@0.1.0-shim-instance)) ) diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index 02c97171e..44c4b194f 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -11,1239 +11,1270 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret ; }; - private builtin.function @core::slice::index::slice_end_index_len_fail(v5: i32, v6: i32) { + private builtin.function @__rustc::__rust_alloc(v5: i32, v6: i32) -> i32 { ^block10(v5: i32, v6: i32): - v7 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v8 = hir.bitcast v7 : ptr; - v9 = hir.load v8 : i32; - v10 = arith.constant 1048600 : i32; - v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v5, v6, v11) - ub.unreachable ; + 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; }; - private builtin.function @ as core::ops::index::Index>::index(v12: i32, v13: i32, v14: i32, v15: i32) { - ^block12(v12: i32, v13: i32, v14: i32, v15: i32): - v18 = arith.constant 8 : u32; - v17 = hir.bitcast v13 : 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; - v23 = hir.load v22 : i32; - v16 = arith.constant 0 : i32; - v25 = hir.bitcast v23 : u32; - v24 = hir.bitcast v15 : u32; - v26 = arith.lte v24, v25 : i1; - v27 = arith.zext v26 : u32; - v28 = hir.bitcast v27 : i32; - v30 = arith.neq v28, v16 : i1; - cf.cond_br v30 ^block14, ^block15; - ^block14: - v908 = arith.constant 4 : u32; - v32 = hir.bitcast v12 : u32; - v34 = arith.add v32, v908 : u32 #[overflow = checked]; - v907 = arith.constant 4 : u32; - v36 = arith.mod v34, v907 : u32; - hir.assertz v36 #[code = 250]; - v31 = arith.sub v15, v14 : i32 #[overflow = wrapping]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v31; - v906 = arith.constant 4 : u32; - v38 = hir.bitcast v13 : u32; - v40 = arith.add v38, v906 : u32 #[overflow = checked]; - v905 = arith.constant 4 : u32; - v42 = arith.mod v40, v905 : u32; - hir.assertz v42 #[code = 250]; - v43 = hir.int_to_ptr v40 : ptr; - v44 = hir.load v43 : i32; - v49 = hir.bitcast v12 : u32; - v904 = arith.constant 4 : u32; - v51 = arith.mod v49, v904 : u32; - hir.assertz v51 #[code = 250]; - v902 = arith.constant 2 : u32; - v47 = arith.shl v14, v902 : i32; - v48 = arith.add v44, v47 : i32 #[overflow = wrapping]; - v52 = hir.int_to_ptr v49 : ptr; - hir.store v52, v48; + private builtin.function @__rustc::__rust_dealloc(v14: i32, v15: i32, v16: i32) { + ^block12(v14: i32, v15: i32, v16: i32): builtin.ret ; - ^block15: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_end_index_len_fail(v15, v23) - ub.unreachable ; }; - private builtin.function @__rustc::__rust_alloc(v53: i32, v54: i32) -> i32 { - ^block16(v53: i32, v54: i32): - v56 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v57 = hir.bitcast v56 : ptr; - v58 = hir.load v57 : i32; - v59 = arith.constant 1048616 : i32; - v60 = arith.add v58, v59 : i32 #[overflow = wrapping]; - v61 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v60, v54, v53) : i32 - builtin.ret v61; + 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 + v925 = 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, v925 : i1; + scf.if v31{ + ^block16: + scf.yield ; + } else { + ^block17: + v923 = arith.constant 0 : i32; + v924 = arith.constant 0 : i32; + v33 = arith.eq v17, v924 : i1; + v34 = arith.zext v33 : u32; + v35 = hir.bitcast v34 : i32; + v37 = arith.neq v35, v923 : i1; + scf.if v37{ + ^block124: + scf.yield ; + } else { + ^block18: + v917 = 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, v917; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v25; }; - private builtin.function @__rustc::__rust_dealloc(v62: i32, v63: i32, v64: i32) { - ^block18(v62: i32, v63: i32, v64: i32): + private builtin.function @basic_wallet_tx_script::bindings::__link_custom_section_describing_imports() { + ^block19: builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v65: i32, v66: i32) -> i32 { - ^block20(v65: i32, v66: i32): - v68 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 1048616 : i32; - v72 = arith.add v70, v71 : i32 #[overflow = wrapping]; - v73 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v72, v66, v65) : i32 - v917 = arith.constant 0 : i32; - v74 = arith.constant 0 : i32; - v75 = arith.eq v73, v74 : i1; - v76 = arith.zext v75 : u32; - v77 = hir.bitcast v76 : i32; - v79 = arith.neq v77, v917 : i1; - scf.if v79{ - ^block22: + 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{ + ^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) scf.yield ; } else { - ^block23: - v915 = arith.constant 0 : i32; - v916 = arith.constant 0 : i32; - v81 = arith.eq v65, v916 : i1; - v82 = arith.zext v81 : u32; - v83 = hir.bitcast v82 : i32; - v85 = arith.neq v83, v915 : i1; - scf.if v85{ - ^block122: + ^block25: + v929 = 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, v929 : i1; + scf.if v60{ + ^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; + v928 = arith.constant 1048600 : i32; + v75 = arith.add v73, v928 : 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) scf.yield ; } else { - ^block24: - v909 = arith.constant 0 : u8; - v88 = hir.bitcast v65 : u32; - v89 = hir.bitcast v73 : u32; - v90 = hir.int_to_ptr v89 : ptr; - hir.mem_set v90, v88, v909; + ^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; + v927 = arith.constant 1048600 : i32; + v65 = arith.add v63, v927 : 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) scf.yield ; }; scf.yield ; }; - builtin.ret v73; + ub.unreachable ; }; - private builtin.function @basic_wallet_tx_script::bindings::__link_custom_section_describing_imports() { - ^block25: + 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; + ^block29: + v936 = arith.constant 4 : u32; + v96 = hir.bitcast v76 : u32; + v98 = arith.add v96, v936 : u32 #[overflow = checked]; + v935 = arith.constant 4 : u32; + v100 = arith.mod v98, v935 : 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; + v934 = arith.constant 4 : u32; + v102 = hir.bitcast v77 : u32; + v104 = arith.add v102, v934 : u32 #[overflow = checked]; + v933 = arith.constant 4 : u32; + v106 = arith.mod v104, v933 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i32; + v113 = hir.bitcast v76 : u32; + v932 = arith.constant 4 : u32; + v115 = arith.mod v113, v932 : u32; + hir.assertz v115 #[code = 250]; + v930 = arith.constant 2 : u32; + v111 = arith.shl v78, v930 : i32; + v112 = arith.add v108, v111 : i32 #[overflow = wrapping]; + v116 = hir.int_to_ptr v113 : ptr; + hir.store v116, v112; 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) + ub.unreachable ; }; - private builtin.function @miden:base/transaction-script@1.0.0#run(v92: felt, v93: felt, v94: felt, v95: felt) { - ^block27(v92: felt, v93: felt, v94: felt, v95: felt): - v100 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v101 = hir.bitcast v100 : ptr; - v102 = hir.load v101 : i32; - v103 = arith.constant 80 : i32; - v104 = arith.sub v102, v103 : i32 #[overflow = wrapping]; - v105 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v106 = hir.bitcast v105 : ptr; - hir.store v106, v104; + 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; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/wit_bindgen::rt::run_ctors_once() - v107 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v95, v94, v93, v92) : felt - v108 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v107) : i64 - v110 = arith.constant 3 : i32; - v109 = arith.trunc v108 : i32; - v111 = arith.band v109, v110 : i32; - v112 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v111) : felt - v96 = arith.constant 0 : i32; - v114 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v96) : felt - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::assert_eq(v112, v114) - v117 = arith.constant 2 : i64; - v119 = hir.cast v117 : u32; - v118 = hir.bitcast v108 : u64; - v120 = arith.shr v118, v119 : u64; - v121 = hir.bitcast v120 : i64; - v122 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u64_unchecked(v121) : felt - v123 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v122) : i64 - v919 = arith.constant 2 : u32; - v124 = arith.trunc v123 : i32; - v127 = arith.shl v124, v919 : i32; - v129 = arith.constant 4 : i32; - v995 = arith.constant 0 : i32; - v115 = arith.constant 64 : i32; - v116 = arith.add v104, v115 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::try_allocate_in(v116, v127, v995, v129, v129) - v132 = arith.constant 68 : u32; - v131 = hir.bitcast v104 : 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 : i32; - v139 = arith.constant 64 : u32; - v138 = hir.bitcast v104 : u32; - v140 = arith.add v138, v139 : u32 #[overflow = checked]; - v994 = arith.constant 4 : u32; - v142 = arith.mod v140, v994 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - v144 = hir.load v143 : i32; - v993 = arith.constant 0 : i32; - v145 = arith.constant 1 : i32; - v146 = arith.eq v144, v145 : i1; - v147 = arith.zext v146 : u32; - v148 = hir.bitcast v147 : i32; - v150 = arith.neq v148, v993 : i1; - v924 = scf.if v150 : u32 { - ^block30: - v361 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v362 = hir.bitcast v361 : ptr; - v363 = hir.load v362 : i32; - v365 = arith.constant 72 : u32; - v364 = hir.bitcast v104 : u32; - v366 = arith.add v364, v365 : u32 #[overflow = checked]; - v992 = arith.constant 4 : u32; - v368 = arith.mod v366, v992 : u32; - hir.assertz v368 #[code = 250]; - v369 = hir.int_to_ptr v366 : ptr; - v370 = hir.load v369 : i32; - v371 = arith.constant 1048600 : i32; - v372 = arith.add v363, v371 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v137, v370, v372) - v920 = arith.constant 0 : u32; - scf.yield v920; + 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 + v938 = arith.constant 2 : u32; + v149 = arith.trunc v148 : i32; + v152 = arith.shl v149, v938 : i32; + v154 = arith.constant 4 : i32; + v1014 = 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, v1014, 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]; + v1013 = arith.constant 4 : u32; + v167 = arith.mod v165, v1013 : u32; + hir.assertz v167 #[code = 250]; + v168 = hir.int_to_ptr v165 : ptr; + v169 = hir.load v168 : i32; + v1012 = 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, v1012 : i1; + v943 = scf.if v175 : u32 { + ^block34: + v387 = arith.constant 72 : u32; + v386 = hir.bitcast v129 : u32; + v388 = arith.add v386, v387 : u32 #[overflow = checked]; + v1011 = arith.constant 4 : u32; + v390 = arith.mod v388, v1011 : 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) + v939 = arith.constant 0 : u32; + scf.yield v939; } else { - ^block31: - v991 = arith.constant 72 : u32; - v151 = hir.bitcast v104 : u32; - v153 = arith.add v151, v991 : u32 #[overflow = checked]; - v990 = arith.constant 4 : u32; - v155 = arith.mod v153, v990 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - v157 = hir.load v156 : i32; - v989 = arith.constant 2 : u32; - v159 = hir.bitcast v157 : u32; - v161 = arith.shr v159, v989 : u32; - v162 = hir.bitcast v161 : i32; - v163 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/std::mem::pipe_preimage_to_memory(v122, v162, v95, v94, v93, v92) : i32 - v165 = arith.constant 28 : u32; - v164 = hir.bitcast v104 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v988 = arith.constant 4 : u32; - v168 = arith.mod v166, v988 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - hir.store v169, v127; - v171 = arith.constant 24 : u32; - v170 = hir.bitcast v104 : u32; - v172 = arith.add v170, v171 : u32 #[overflow = checked]; - v987 = arith.constant 4 : u32; - v174 = arith.mod v172, v987 : u32; - hir.assertz v174 #[code = 250]; - v175 = hir.int_to_ptr v172 : ptr; - hir.store v175, v157; - v177 = arith.constant 20 : u32; - v176 = hir.bitcast v104 : u32; - v178 = arith.add v176, v177 : u32 #[overflow = checked]; - v986 = arith.constant 4 : u32; - v180 = arith.mod v178, v986 : u32; + ^block35: + v1010 = arith.constant 72 : u32; + v176 = hir.bitcast v129 : u32; + v178 = arith.add v176, v1010 : u32 #[overflow = checked]; + v1009 = arith.constant 4 : u32; + v180 = arith.mod v178, v1009 : u32; hir.assertz v180 #[code = 250]; v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v137; - v984 = arith.constant 0 : i32; - v985 = arith.constant 0 : i32; - v183 = arith.eq v127, v985 : i1; - v184 = arith.zext v183 : u32; - v185 = hir.bitcast v184 : i32; - v187 = arith.neq v185, v984 : i1; - v926 = scf.if v187 : u32 { - ^block127: - v983 = arith.constant 0 : u32; - scf.yield v983; + v182 = hir.load v181 : i32; + v1008 = arith.constant 2 : u32; + v184 = hir.bitcast v182 : u32; + v186 = arith.shr v184, v1008 : 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]; + v1007 = arith.constant 4 : u32; + v193 = arith.mod v191, v1007 : 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]; + v1006 = arith.constant 4 : u32; + v199 = arith.mod v197, v1006 : 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]; + v1005 = arith.constant 4 : u32; + v205 = arith.mod v203, v1005 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v162; + v1003 = arith.constant 0 : i32; + v1004 = arith.constant 0 : i32; + v208 = arith.eq v152, v1004 : i1; + v209 = arith.zext v208 : u32; + v210 = hir.bitcast v209 : i32; + v212 = arith.neq v210, v1003 : i1; + v945 = scf.if v212 : u32 { + ^block133: + v1002 = arith.constant 0 : u32; + scf.yield v1002; } else { - ^block32: - v189 = arith.constant 12 : u32; - v188 = hir.bitcast v157 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v982 = arith.constant 4 : u32; - v192 = arith.mod v190, v982 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - v194 = hir.load v193 : felt; - v196 = arith.constant 8 : u32; - v195 = hir.bitcast v157 : u32; - v197 = arith.add v195, v196 : u32 #[overflow = checked]; - v981 = arith.constant 4 : u32; - v199 = arith.mod v197, v981 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - v201 = hir.load v200 : felt; - v980 = arith.constant 4 : u32; - v202 = hir.bitcast v157 : u32; - v204 = arith.add v202, v980 : u32 #[overflow = checked]; - v979 = arith.constant 4 : u32; - v206 = arith.mod v204, v979 : u32; - hir.assertz v206 #[code = 250]; - v207 = hir.int_to_ptr v204 : ptr; - v208 = hir.load v207 : felt; - v209 = hir.bitcast v157 : u32; - v978 = arith.constant 4 : u32; - v211 = arith.mod v209, v978 : u32; - hir.assertz v211 #[code = 250]; - v212 = hir.int_to_ptr v209 : ptr; - v213 = hir.load v212 : felt; - v976 = arith.constant 8 : i32; - v977 = arith.constant 4 : i32; - v216 = arith.constant 20 : i32; - v217 = arith.add v104, v216 : i32 #[overflow = wrapping]; - v214 = arith.constant 8 : i32; - v215 = arith.add v104, v214 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v215, v217, v977, v976) - v975 = arith.constant 12 : u32; - v220 = hir.bitcast v104 : u32; - v222 = arith.add v220, v975 : u32 #[overflow = checked]; - v974 = arith.constant 4 : u32; - v224 = arith.mod v222, v974 : u32; + ^block36: + v214 = arith.constant 12 : u32; + v213 = hir.bitcast v182 : u32; + v215 = arith.add v213, v214 : u32 #[overflow = checked]; + v1001 = arith.constant 4 : u32; + v217 = arith.mod v215, v1001 : 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]; + v1000 = arith.constant 4 : u32; + v224 = arith.mod v222, v1000 : u32; hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : i32; - v972 = arith.constant 0 : i32; - v973 = arith.constant 4 : i32; - v228 = arith.neq v226, v973 : i1; - v229 = arith.zext v228 : u32; - v230 = hir.bitcast v229 : i32; - v232 = arith.neq v230, v972 : i1; - v928 = scf.if v232 : u32 { - ^block126: - v971 = arith.constant 0 : u32; - scf.yield v971; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : felt; + v999 = arith.constant 4 : u32; + v227 = hir.bitcast v182 : u32; + v229 = arith.add v227, v999 : u32 #[overflow = checked]; + v998 = arith.constant 4 : u32; + v231 = arith.mod v229, v998 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + v233 = hir.load v232 : felt; + v234 = hir.bitcast v182 : u32; + v997 = arith.constant 4 : u32; + v236 = arith.mod v234, v997 : u32; + hir.assertz v236 #[code = 250]; + v237 = hir.int_to_ptr v234 : ptr; + v238 = hir.load v237 : felt; + v995 = arith.constant 8 : i32; + v996 = 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, v996, v995) + v994 = arith.constant 12 : u32; + v245 = hir.bitcast v129 : u32; + v247 = arith.add v245, v994 : u32 #[overflow = checked]; + v993 = arith.constant 4 : u32; + v249 = arith.mod v247, v993 : u32; + hir.assertz v249 #[code = 250]; + v250 = hir.int_to_ptr v247 : ptr; + v251 = hir.load v250 : i32; + v991 = arith.constant 0 : i32; + v992 = arith.constant 4 : i32; + v253 = arith.neq v251, v992 : i1; + v254 = arith.zext v253 : u32; + v255 = hir.bitcast v254 : i32; + v257 = arith.neq v255, v991 : i1; + v947 = scf.if v257 : u32 { + ^block132: + v990 = arith.constant 0 : u32; + scf.yield v990; } else { - ^block33: - v970 = arith.constant 8 : u32; - v233 = hir.bitcast v104 : u32; - v235 = arith.add v233, v970 : u32 #[overflow = checked]; - v969 = arith.constant 4 : u32; - v237 = arith.mod v235, v969 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : i32; - v240 = hir.bitcast v239 : u32; - v968 = arith.constant 4 : u32; - v242 = arith.mod v240, v968 : u32; - hir.assertz v242 #[code = 250]; - v243 = hir.int_to_ptr v240 : ptr; - v244 = hir.load v243 : i64; - v967 = arith.constant 8 : i32; - v250 = arith.add v239, v967 : i32 #[overflow = wrapping]; - v251 = hir.bitcast v250 : u32; - v966 = arith.constant 4 : u32; - v253 = arith.mod v251, v966 : u32; - hir.assertz v253 #[code = 250]; - v254 = hir.int_to_ptr v251 : ptr; - v255 = hir.load v254 : i64; - v965 = arith.constant 8 : i32; - v245 = arith.constant 32 : i32; - v246 = arith.add v104, v245 : i32 #[overflow = wrapping]; - v248 = arith.add v246, v965 : i32 #[overflow = wrapping]; - v256 = hir.bitcast v248 : u32; - v964 = arith.constant 8 : u32; - v258 = arith.mod v256, v964 : u32; - hir.assertz v258 #[code = 250]; - v259 = hir.int_to_ptr v256 : ptr; - hir.store v259, v255; - v261 = arith.constant 32 : u32; - v260 = hir.bitcast v104 : u32; - v262 = arith.add v260, v261 : u32 #[overflow = checked]; - v963 = arith.constant 8 : u32; - v264 = arith.mod v262, v963 : u32; - hir.assertz v264 #[code = 250]; - v265 = hir.int_to_ptr v262 : ptr; - hir.store v265, v244; - v961 = arith.constant 32 : i32; - v269 = arith.add v104, v961 : i32 #[overflow = wrapping]; - v962 = arith.constant 64 : i32; - v267 = arith.add v104, v962 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v267, v269) - v960 = arith.constant 64 : i32; - v271 = arith.add v104, v960 : i32 #[overflow = wrapping]; - v272 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v213, v208, v201, v194, v271) : felt - v276 = arith.constant 12 : i32; - v958 = arith.constant 8 : i32; - v959 = arith.constant 20 : i32; - v274 = arith.add v104, v959 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v104, v274, v958, v276) - v957 = arith.constant 4 : u32; - v277 = hir.bitcast v104 : u32; - v279 = arith.add v277, v957 : u32 #[overflow = checked]; - v956 = arith.constant 4 : u32; - v281 = arith.mod v279, v956 : u32; - hir.assertz v281 #[code = 250]; - v282 = hir.int_to_ptr v279 : ptr; - v283 = hir.load v282 : i32; - v954 = arith.constant 0 : i32; - v955 = arith.constant 4 : i32; - v285 = arith.neq v283, v955 : i1; - v286 = arith.zext v285 : u32; - v287 = hir.bitcast v286 : i32; - v289 = arith.neq v287, v954 : i1; - scf.if v289{ - ^block125: + ^block37: + v989 = arith.constant 8 : u32; + v262 = hir.bitcast v129 : u32; + v264 = arith.add v262, v989 : u32 #[overflow = checked]; + v988 = arith.constant 4 : u32; + v266 = arith.mod v264, v988 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + v268 = hir.load v267 : i32; + v987 = arith.constant 8 : i32; + v270 = arith.add v268, v987 : i32 #[overflow = wrapping]; + v271 = hir.bitcast v270 : u32; + v986 = arith.constant 4 : u32; + v273 = arith.mod v271, v986 : u32; + hir.assertz v273 #[code = 250]; + v274 = hir.int_to_ptr v271 : ptr; + v275 = hir.load v274 : i64; + v985 = arith.constant 8 : i32; + v258 = arith.constant 32 : i32; + v259 = arith.add v129, v258 : i32 #[overflow = wrapping]; + v261 = arith.add v259, v985 : i32 #[overflow = wrapping]; + v276 = hir.bitcast v261 : u32; + v984 = arith.constant 8 : u32; + v278 = arith.mod v276, v984 : u32; + hir.assertz v278 #[code = 250]; + v279 = hir.int_to_ptr v276 : ptr; + hir.store v279, v275; + v280 = hir.bitcast v268 : u32; + v983 = arith.constant 4 : u32; + v282 = arith.mod v280, v983 : 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]; + v982 = arith.constant 8 : u32; + v289 = arith.mod v287, v982 : u32; + hir.assertz v289 #[code = 250]; + v290 = hir.int_to_ptr v287 : ptr; + hir.store v290, v284; + v980 = arith.constant 32 : i32; + v294 = arith.add v129, v980 : i32 #[overflow = wrapping]; + v981 = arith.constant 64 : i32; + v292 = arith.add v129, v981 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v292, v294) + v979 = arith.constant 64 : i32; + v296 = arith.add v129, v979 : 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; + v977 = arith.constant 8 : i32; + v978 = arith.constant 20 : i32; + v299 = arith.add v129, v978 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v129, v299, v977, v301) + v976 = arith.constant 4 : u32; + v302 = hir.bitcast v129 : u32; + v304 = arith.add v302, v976 : u32 #[overflow = checked]; + v975 = arith.constant 4 : u32; + v306 = arith.mod v304, v975 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + v308 = hir.load v307 : i32; + v973 = arith.constant 0 : i32; + v974 = arith.constant 4 : i32; + v310 = arith.neq v308, v974 : i1; + v311 = arith.zext v310 : u32; + v312 = hir.bitcast v311 : i32; + v314 = arith.neq v312, v973 : i1; + scf.if v314{ + ^block131: scf.yield ; } else { - ^block34: - v290 = hir.bitcast v104 : u32; - v953 = arith.constant 4 : u32; - v292 = arith.mod v290, v953 : u32; - hir.assertz v292 #[code = 250]; - v293 = hir.int_to_ptr v290 : ptr; - v294 = hir.load v293 : i32; - v295 = hir.bitcast v294 : u32; - v952 = arith.constant 4 : u32; - v297 = arith.mod v295, v952 : u32; - hir.assertz v297 #[code = 250]; - v298 = hir.int_to_ptr v295 : ptr; - v299 = hir.load v298 : i64; - v951 = arith.constant 8 : i32; - v305 = arith.add v294, v951 : i32 #[overflow = wrapping]; - v306 = hir.bitcast v305 : u32; - v950 = arith.constant 4 : u32; - v308 = arith.mod v306, v950 : u32; - hir.assertz v308 #[code = 250]; - v309 = hir.int_to_ptr v306 : ptr; - v310 = hir.load v309 : i64; - v949 = arith.constant 8 : i32; - v300 = arith.constant 48 : i32; - v301 = arith.add v104, v300 : i32 #[overflow = wrapping]; - v303 = arith.add v301, v949 : i32 #[overflow = wrapping]; - v311 = hir.bitcast v303 : u32; - v948 = arith.constant 8 : u32; - v313 = arith.mod v311, v948 : u32; - hir.assertz v313 #[code = 250]; - v314 = hir.int_to_ptr v311 : ptr; - hir.store v314, v310; - v316 = arith.constant 48 : u32; - v315 = hir.bitcast v104 : u32; - v317 = arith.add v315, v316 : u32 #[overflow = checked]; - v947 = arith.constant 8 : u32; - v319 = arith.mod v317, v947 : u32; - hir.assertz v319 #[code = 250]; - v320 = hir.int_to_ptr v317 : ptr; - hir.store v320, v299; - v945 = arith.constant 48 : i32; - v324 = arith.add v104, v945 : i32 #[overflow = wrapping]; - v946 = arith.constant 64 : i32; - v322 = arith.add v104, v946 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v322, v324) - v944 = arith.constant 64 : u32; - v325 = hir.bitcast v104 : u32; - v327 = arith.add v325, v944 : u32 #[overflow = checked]; - v943 = arith.constant 4 : u32; - v329 = arith.mod v327, v943 : u32; - hir.assertz v329 #[code = 250]; - v330 = hir.int_to_ptr v327 : ptr; - v331 = hir.load v330 : felt; - v942 = arith.constant 68 : u32; - v332 = hir.bitcast v104 : u32; - v334 = arith.add v332, v942 : u32 #[overflow = checked]; - v941 = arith.constant 4 : u32; - v336 = arith.mod v334, v941 : u32; - hir.assertz v336 #[code = 250]; - v337 = hir.int_to_ptr v334 : ptr; - v338 = hir.load v337 : felt; - v940 = arith.constant 72 : u32; - v339 = hir.bitcast v104 : u32; - v341 = arith.add v339, v940 : u32 #[overflow = checked]; - v939 = arith.constant 4 : u32; - v343 = arith.mod v341, v939 : u32; - hir.assertz v343 #[code = 250]; - v344 = hir.int_to_ptr v341 : ptr; - v345 = hir.load v344 : felt; - v347 = arith.constant 76 : u32; - v346 = hir.bitcast v104 : u32; - v348 = arith.add v346, v347 : u32 #[overflow = checked]; - v938 = arith.constant 4 : u32; - v350 = arith.mod v348, v938 : u32; - hir.assertz v350 #[code = 250]; - v351 = hir.int_to_ptr v348 : ptr; - v352 = hir.load v351 : 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(v331, v338, v345, v352, v272) - v936 = arith.constant 4 : i32; - v937 = arith.constant 20 : i32; - v354 = arith.add v104, v937 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::deallocate(v354, v936, v936) - v935 = arith.constant 80 : i32; - v358 = arith.add v104, v935 : i32 #[overflow = wrapping]; - v359 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v360 = hir.bitcast v359 : ptr; - hir.store v360, v358; + ^block38: + v319 = hir.bitcast v129 : u32; + v972 = arith.constant 4 : u32; + v321 = arith.mod v319, v972 : u32; + hir.assertz v321 #[code = 250]; + v322 = hir.int_to_ptr v319 : ptr; + v323 = hir.load v322 : i32; + v971 = arith.constant 8 : i32; + v325 = arith.add v323, v971 : i32 #[overflow = wrapping]; + v326 = hir.bitcast v325 : u32; + v970 = arith.constant 4 : u32; + v328 = arith.mod v326, v970 : u32; + hir.assertz v328 #[code = 250]; + v329 = hir.int_to_ptr v326 : ptr; + v330 = hir.load v329 : i64; + v969 = arith.constant 8 : i32; + v315 = arith.constant 48 : i32; + v316 = arith.add v129, v315 : i32 #[overflow = wrapping]; + v318 = arith.add v316, v969 : i32 #[overflow = wrapping]; + v331 = hir.bitcast v318 : u32; + v968 = arith.constant 8 : u32; + v333 = arith.mod v331, v968 : u32; + hir.assertz v333 #[code = 250]; + v334 = hir.int_to_ptr v331 : ptr; + hir.store v334, v330; + v335 = hir.bitcast v323 : u32; + v967 = arith.constant 4 : u32; + v337 = arith.mod v335, v967 : 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]; + v966 = arith.constant 8 : u32; + v344 = arith.mod v342, v966 : u32; + hir.assertz v344 #[code = 250]; + v345 = hir.int_to_ptr v342 : ptr; + hir.store v345, v339; + v964 = arith.constant 48 : i32; + v349 = arith.add v129, v964 : i32 #[overflow = wrapping]; + v965 = arith.constant 64 : i32; + v347 = arith.add v129, v965 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v347, v349) + v963 = arith.constant 64 : u32; + v350 = hir.bitcast v129 : u32; + v352 = arith.add v350, v963 : u32 #[overflow = checked]; + v962 = arith.constant 4 : u32; + v354 = arith.mod v352, v962 : u32; + hir.assertz v354 #[code = 250]; + v355 = hir.int_to_ptr v352 : ptr; + v356 = hir.load v355 : felt; + v961 = arith.constant 68 : u32; + v357 = hir.bitcast v129 : u32; + v359 = arith.add v357, v961 : u32 #[overflow = checked]; + v960 = arith.constant 4 : u32; + v361 = arith.mod v359, v960 : u32; + hir.assertz v361 #[code = 250]; + v362 = hir.int_to_ptr v359 : ptr; + v363 = hir.load v362 : felt; + v959 = arith.constant 72 : u32; + v364 = hir.bitcast v129 : u32; + v366 = arith.add v364, v959 : u32 #[overflow = checked]; + v958 = arith.constant 4 : u32; + v368 = arith.mod v366, v958 : 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]; + v957 = arith.constant 4 : u32; + v375 = arith.mod v373, v957 : 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) + v955 = arith.constant 4 : i32; + v956 = arith.constant 20 : i32; + v379 = arith.add v129, v956 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v379, v955, v955) + v954 = arith.constant 80 : i32; + v383 = arith.add v129, v954 : 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; scf.yield ; }; - v922 = arith.constant 1 : u32; - v934 = arith.constant 0 : u32; - v932 = cf.select v289, v934, v922 : u32; - scf.yield v932; + v941 = arith.constant 1 : u32; + v953 = arith.constant 0 : u32; + v951 = cf.select v314, v953, v941 : u32; + scf.yield v951; }; - scf.yield v928; + scf.yield v947; }; - scf.yield v926; + scf.yield v945; }; - v933 = arith.constant 0 : u32; - v931 = arith.eq v924, v933 : i1; - cf.cond_br v931 ^block29, ^block129; - ^block29: + v952 = arith.constant 0 : u32; + v950 = arith.eq v943, v952 : i1; + cf.cond_br v950 ^block33, ^block135; + ^block33: ub.unreachable ; - ^block129: + ^block135: builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block35: + ^block39: builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block37: - v374 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v375 = hir.bitcast v374 : ptr; - v376 = hir.load v375 : i32; - v377 = arith.constant 1048620 : i32; - v378 = arith.add v376, v377 : i32 #[overflow = wrapping]; - v379 = hir.bitcast v378 : u32; - v380 = hir.int_to_ptr v379 : ptr; - v381 = hir.load v380 : u8; - v373 = arith.constant 0 : i32; - v382 = arith.zext v381 : u32; - v383 = hir.bitcast v382 : i32; - v385 = arith.neq v383, v373 : i1; - scf.if v385{ - ^block39: + ^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{ + ^block43: scf.yield ; } else { - ^block40: - v386 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v387 = hir.bitcast v386 : ptr; - v388 = hir.load v387 : i32; + ^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; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__wasm_call_ctors() - v997 = arith.constant 1 : u8; - v999 = arith.constant 1048620 : i32; - v390 = arith.add v388, v999 : i32 #[overflow = wrapping]; - v394 = hir.bitcast v390 : u32; - v395 = hir.int_to_ptr v394 : ptr; - hir.store v395, v997; + v1016 = arith.constant 1 : u8; + v1018 = arith.constant 1048620 : i32; + v410 = arith.add v408, v1018 : i32 #[overflow = wrapping]; + v414 = hir.bitcast v410 : u32; + v415 = hir.int_to_ptr v414 : ptr; + hir.store v415, v1016; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v396: i32, v397: i32, v398: i32) -> i32 { - ^block41(v396: i32, v397: i32, v398: i32): - v401 = arith.constant 16 : i32; - v400 = arith.constant 0 : i32; - v1001 = arith.constant 16 : u32; - v403 = hir.bitcast v397 : u32; - v405 = arith.gt v403, v1001 : i1; - v406 = arith.zext v405 : u32; - v407 = hir.bitcast v406 : i32; - v409 = arith.neq v407, v400 : i1; - v410 = cf.select v409, v397, v401 : i32; - v1041 = arith.constant 0 : i32; - v411 = arith.constant -1 : i32; - v412 = arith.add v410, v411 : i32 #[overflow = wrapping]; - v413 = arith.band v410, v412 : i32; - v415 = arith.neq v413, v1041 : i1; - v1010, v1011 = scf.if v415 : i32, u32 { - ^block137: - v1002 = arith.constant 0 : u32; - v1006 = ub.poison i32 : i32; - scf.yield v1006, v1002; + 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; + v1020 = arith.constant 16 : u32; + v423 = hir.bitcast v417 : u32; + v425 = arith.gt v423, v1020 : i1; + v426 = arith.zext v425 : u32; + v427 = hir.bitcast v426 : i32; + v429 = arith.neq v427, v420 : i1; + v430 = cf.select v429, v417, v421 : i32; + v1060 = 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, v1060 : i1; + v1029, v1030 = scf.if v435 : i32, u32 { + ^block143: + v1021 = arith.constant 0 : u32; + v1025 = ub.poison i32 : i32; + scf.yield v1025, v1021; } else { - ^block44: - v417 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::ptr::alignment::Alignment::max(v397, v410) : i32 - v1040 = arith.constant 0 : i32; - v416 = arith.constant -2147483648 : i32; - v418 = arith.sub v416, v417 : i32 #[overflow = wrapping]; - v420 = hir.bitcast v418 : u32; - v419 = hir.bitcast v398 : u32; - v421 = arith.gt v419, v420 : i1; - v422 = arith.zext v421 : u32; - v423 = hir.bitcast v422 : i32; - v425 = arith.neq v423, v1040 : i1; - v1025 = scf.if v425 : i32 { - ^block136: - v1039 = ub.poison i32 : i32; - scf.yield v1039; + ^block48: + v437 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::max(v417, v430) : i32 + v1059 = 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, v1059 : i1; + v1044 = scf.if v445 : i32 { + ^block142: + v1058 = ub.poison i32 : i32; + scf.yield v1058; } else { - ^block45: - v1037 = arith.constant 0 : i32; - v431 = arith.sub v1037, v417 : i32 #[overflow = wrapping]; - v1038 = arith.constant -1 : i32; - v427 = arith.add v398, v417 : i32 #[overflow = wrapping]; - v429 = arith.add v427, v1038 : i32 #[overflow = wrapping]; - v432 = arith.band v429, v431 : i32; - v433 = hir.bitcast v396 : u32; - v434 = arith.constant 4 : u32; - v435 = arith.mod v433, v434 : u32; - hir.assertz v435 #[code = 250]; - v436 = hir.int_to_ptr v433 : ptr; - v437 = hir.load v436 : i32; - v1036 = arith.constant 0 : i32; - v439 = arith.neq v437, v1036 : i1; - scf.if v439{ - ^block135: + ^block49: + v1056 = arith.constant 0 : i32; + v451 = arith.sub v1056, v437 : i32 #[overflow = wrapping]; + v1057 = arith.constant -1 : i32; + v447 = arith.add v418, v437 : i32 #[overflow = wrapping]; + v449 = arith.add v447, v1057 : 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; + v1055 = arith.constant 0 : i32; + v459 = arith.neq v457, v1055 : i1; + scf.if v459{ + ^block141: scf.yield ; } else { - ^block47: - v440 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 - v441 = hir.mem_size : u32; - v447 = hir.bitcast v396 : u32; - v1035 = arith.constant 4 : u32; - v449 = arith.mod v447, v1035 : u32; - hir.assertz v449 #[code = 250]; - v1034 = arith.constant 16 : u32; - v442 = hir.bitcast v441 : i32; - v445 = arith.shl v442, v1034 : i32; - v446 = arith.add v440, v445 : i32 #[overflow = wrapping]; - v450 = hir.int_to_ptr v447 : ptr; - hir.store v450, v446; + ^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; + v1054 = arith.constant 4 : u32; + v469 = arith.mod v467, v1054 : u32; + hir.assertz v469 #[code = 250]; + v1053 = arith.constant 16 : u32; + v462 = hir.bitcast v461 : i32; + v465 = arith.shl v462, v1053 : i32; + v466 = arith.add v460, v465 : i32 #[overflow = wrapping]; + v470 = hir.int_to_ptr v467 : ptr; + hir.store v470, v466; scf.yield ; }; - v453 = hir.bitcast v396 : u32; - v1033 = arith.constant 4 : u32; - v455 = arith.mod v453, v1033 : u32; - hir.assertz v455 #[code = 250]; - v456 = hir.int_to_ptr v453 : ptr; - v457 = hir.load v456 : i32; - v1031 = arith.constant 0 : i32; - v1032 = arith.constant -1 : i32; - v459 = arith.bxor v457, v1032 : i32; - v461 = hir.bitcast v459 : u32; - v460 = hir.bitcast v432 : u32; - v462 = arith.gt v460, v461 : i1; - v463 = arith.zext v462 : u32; - v464 = hir.bitcast v463 : i32; - v466 = arith.neq v464, v1031 : i1; - v1024 = scf.if v466 : i32 { - ^block48: - v1030 = arith.constant 0 : i32; - scf.yield v1030; + v473 = hir.bitcast v416 : u32; + v1052 = arith.constant 4 : u32; + v475 = arith.mod v473, v1052 : u32; + hir.assertz v475 #[code = 250]; + v476 = hir.int_to_ptr v473 : ptr; + v477 = hir.load v476 : i32; + v1050 = arith.constant 0 : i32; + v1051 = arith.constant -1 : i32; + v479 = arith.bxor v477, v1051 : 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, v1050 : i1; + v1043 = scf.if v486 : i32 { + ^block52: + v1049 = arith.constant 0 : i32; + scf.yield v1049; } else { - ^block49: - v468 = hir.bitcast v396 : u32; - v1029 = arith.constant 4 : u32; - v470 = arith.mod v468, v1029 : u32; - hir.assertz v470 #[code = 250]; - v467 = arith.add v457, v432 : i32 #[overflow = wrapping]; - v471 = hir.int_to_ptr v468 : ptr; - hir.store v471, v467; - v473 = arith.add v457, v417 : i32 #[overflow = wrapping]; - scf.yield v473; + ^block53: + v488 = hir.bitcast v416 : u32; + v1048 = arith.constant 4 : u32; + v490 = arith.mod v488, v1048 : 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; }; - scf.yield v1024; + scf.yield v1043; }; - v1007 = arith.constant 1 : u32; - v1028 = arith.constant 0 : u32; - v1026 = cf.select v425, v1028, v1007 : u32; - scf.yield v1025, v1026; + v1026 = arith.constant 1 : u32; + v1047 = arith.constant 0 : u32; + v1045 = cf.select v445, v1047, v1026 : u32; + scf.yield v1044, v1045; }; - v1027 = arith.constant 0 : u32; - v1023 = arith.eq v1011, v1027 : i1; - cf.cond_br v1023 ^block43, ^block139(v1010); - ^block43: + v1046 = arith.constant 0 : u32; + v1042 = arith.eq v1030, v1046 : i1; + cf.cond_br v1042 ^block47, ^block145(v1029); + ^block47: ub.unreachable ; - ^block139(v1003: i32): - builtin.ret v1003; + ^block145(v1022: i32): + builtin.ret v1022; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block50: - v476 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v476; + ^block54: + v496 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v496; }; - private builtin.function @miden_base_sys::bindings::output_note::create(v478: felt, v479: felt, v480: felt, v481: felt, v482: i32) -> felt { - ^block54(v478: felt, v479: felt, v480: felt, v481: felt, v482: i32): - v485 = arith.constant 12 : u32; - v484 = hir.bitcast v482 : u32; - v486 = arith.add v484, v485 : u32 #[overflow = checked]; - v487 = arith.constant 4 : u32; - v488 = arith.mod v486, v487 : u32; - hir.assertz v488 #[code = 250]; - v489 = hir.int_to_ptr v486 : ptr; - v490 = hir.load v489 : felt; - v492 = arith.constant 8 : u32; - v491 = hir.bitcast v482 : u32; - v493 = arith.add v491, v492 : u32 #[overflow = checked]; - v1045 = arith.constant 4 : u32; - v495 = arith.mod v493, v1045 : u32; - hir.assertz v495 #[code = 250]; - v496 = hir.int_to_ptr v493 : ptr; - v497 = hir.load v496 : felt; - v1044 = arith.constant 4 : u32; - v498 = hir.bitcast v482 : u32; - v500 = arith.add v498, v1044 : u32 #[overflow = checked]; - v1043 = arith.constant 4 : u32; - v502 = arith.mod v500, v1043 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - v504 = hir.load v503 : felt; - v505 = hir.bitcast v482 : u32; - v1042 = arith.constant 4 : u32; - v507 = arith.mod v505, v1042 : u32; - hir.assertz v507 #[code = 250]; - v508 = hir.int_to_ptr v505 : ptr; - v509 = hir.load v508 : felt; - v510 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::output_note::create(v478, v479, v480, v481, v490, v497, v504, v509) : felt - builtin.ret v510; + private builtin.function @miden_base_sys::bindings::output_note::create(v498: felt, v499: felt, v500: felt, v501: felt, v502: i32) -> felt { + ^block58(v498: felt, v499: felt, v500: felt, v501: felt, v502: i32): + v505 = arith.constant 12 : u32; + v504 = hir.bitcast v502 : u32; + v506 = arith.add v504, v505 : u32 #[overflow = checked]; + v507 = arith.constant 4 : u32; + v508 = arith.mod v506, v507 : u32; + hir.assertz v508 #[code = 250]; + v509 = hir.int_to_ptr v506 : ptr; + v510 = hir.load v509 : felt; + v512 = arith.constant 8 : u32; + v511 = hir.bitcast v502 : u32; + v513 = arith.add v511, v512 : u32 #[overflow = checked]; + v1064 = arith.constant 4 : u32; + v515 = arith.mod v513, v1064 : u32; + hir.assertz v515 #[code = 250]; + v516 = hir.int_to_ptr v513 : ptr; + v517 = hir.load v516 : felt; + v1063 = arith.constant 4 : u32; + v518 = hir.bitcast v502 : u32; + v520 = arith.add v518, v1063 : u32 #[overflow = checked]; + v1062 = arith.constant 4 : u32; + v522 = arith.mod v520, v1062 : u32; + hir.assertz v522 #[code = 250]; + v523 = hir.int_to_ptr v520 : ptr; + v524 = hir.load v523 : felt; + v525 = hir.bitcast v502 : u32; + v1061 = arith.constant 4 : u32; + v527 = arith.mod v525, v1061 : u32; + hir.assertz v527 #[code = 250]; + v528 = hir.int_to_ptr v525 : ptr; + v529 = hir.load v528 : felt; + v530 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::output_note::create(v498, v499, v500, v501, v510, v517, v524, v529) : felt + builtin.ret v530; }; - private builtin.function @>::from(v511: i32, v512: i32) { - ^block56(v511: i32, v512: i32): - v514 = arith.constant 8 : u32; - v513 = hir.bitcast v512 : u32; - v515 = arith.add v513, v514 : u32 #[overflow = checked]; - v516 = arith.constant 4 : u32; - v517 = arith.mod v515, v516 : u32; - hir.assertz v517 #[code = 250]; - v518 = hir.int_to_ptr v515 : ptr; - v519 = hir.load v518 : i64; - v1049 = arith.constant 8 : u32; - v520 = hir.bitcast v511 : u32; - v522 = arith.add v520, v1049 : u32 #[overflow = checked]; - v1048 = arith.constant 8 : u32; - v524 = arith.mod v522, v1048 : u32; - hir.assertz v524 #[code = 250]; - v525 = hir.int_to_ptr v522 : ptr; - hir.store v525, v519; - v526 = hir.bitcast v512 : u32; - v1047 = arith.constant 4 : u32; - v528 = arith.mod v526, v1047 : u32; - hir.assertz v528 #[code = 250]; - v529 = hir.int_to_ptr v526 : ptr; - v530 = hir.load v529 : i64; - v531 = hir.bitcast v511 : u32; - v1046 = arith.constant 8 : u32; - v533 = arith.mod v531, v1046 : u32; - hir.assertz v533 #[code = 250]; - v534 = hir.int_to_ptr v531 : ptr; - hir.store v534, v530; + private builtin.function @>::from(v531: i32, v532: i32) { + ^block60(v531: i32, v532: i32): + v534 = arith.constant 8 : u32; + v533 = hir.bitcast v532 : u32; + v535 = arith.add v533, v534 : u32 #[overflow = checked]; + v536 = arith.constant 4 : u32; + v537 = arith.mod v535, v536 : u32; + hir.assertz v537 #[code = 250]; + v538 = hir.int_to_ptr v535 : ptr; + v539 = hir.load v538 : i64; + v1068 = arith.constant 8 : u32; + v540 = hir.bitcast v531 : u32; + v542 = arith.add v540, v1068 : u32 #[overflow = checked]; + v1067 = arith.constant 8 : u32; + v544 = arith.mod v542, v1067 : u32; + hir.assertz v544 #[code = 250]; + v545 = hir.int_to_ptr v542 : ptr; + hir.store v545, v539; + v546 = hir.bitcast v532 : u32; + v1066 = arith.constant 4 : u32; + v548 = arith.mod v546, v1066 : u32; + hir.assertz v548 #[code = 250]; + v549 = hir.int_to_ptr v546 : ptr; + v550 = hir.load v549 : i64; + v551 = hir.bitcast v531 : u32; + v1065 = arith.constant 8 : u32; + v553 = arith.mod v551, v1065 : u32; + hir.assertz v553 #[code = 250]; + v554 = hir.int_to_ptr v551 : ptr; + hir.store v554, v550; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v535: i64) -> felt { - ^block58(v535: i64): - v536 = hir.cast v535 : felt; - builtin.ret v536; - }; - - private builtin.function @intrinsics::felt::from_u32(v538: i32) -> felt { - ^block60(v538: i32): - v539 = hir.bitcast v538 : felt; - builtin.ret v539; + private builtin.function @intrinsics::advice::adv_push_mapvaln(v555: felt, v556: felt, v557: felt, v558: felt) -> felt { + ^block62(v555: felt, v556: felt, v557: felt, v558: felt): + v559 = hir.exec @intrinsics/advice/adv_push_mapvaln(v555, v556, v557, v558) : felt + builtin.ret v559; }; - private builtin.function @intrinsics::felt::as_u64(v541: felt) -> i64 { - ^block62(v541: felt): - v542 = hir.cast v541 : i64; - builtin.ret v542; + private builtin.function @intrinsics::felt::as_u64(v561: felt) -> i64 { + ^block65(v561: felt): + v562 = hir.cast v561 : i64; + builtin.ret v562; }; - private builtin.function @intrinsics::felt::assert_eq(v544: felt, v545: felt) { - ^block64(v544: felt, v545: felt): - hir.assert_eq v544, v545; + private builtin.function @intrinsics::felt::assert_eq(v564: felt, v565: felt) { + ^block67(v564: felt, v565: felt): + hir.assert_eq v564, v565; builtin.ret ; }; - private builtin.function @intrinsics::advice::adv_push_mapvaln(v546: felt, v547: felt, v548: felt, v549: felt) -> felt { - ^block66(v546: felt, v547: felt, v548: felt, v549: felt): - v550 = hir.exec @intrinsics/advice/adv_push_mapvaln(v546, v547, v548, v549) : felt - builtin.ret v550; + private builtin.function @intrinsics::felt::from_u32(v566: i32) -> felt { + ^block69(v566: i32): + v567 = hir.bitcast v566 : felt; + builtin.ret v567; }; - private builtin.function @std::mem::pipe_preimage_to_memory(v552: felt, v553: i32, v554: felt, v555: felt, v556: felt, v557: felt) -> i32 { - ^block69(v552: felt, v553: i32, v554: felt, v555: felt, v556: felt, v557: felt): - v558 = hir.exec @std/mem/pipe_preimage_to_memory(v552, v553, v554, v555, v556, v557) : i32 - builtin.ret v558; + private builtin.function @intrinsics::felt::from_u64_unchecked(v569: i64) -> felt { + ^block71(v569: i64): + v570 = hir.cast v569 : felt; + builtin.ret v570; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v560: i32, v561: i32, v562: i32) { - ^block73(v560: i32, v561: i32, v562: i32): - v564 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v565 = hir.bitcast v564 : ptr; - v566 = hir.load v565 : i32; - v567 = arith.constant 16 : i32; - v568 = arith.sub v566, v567 : i32 #[overflow = wrapping]; - v569 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v570 = hir.bitcast v569 : ptr; - hir.store v570, v568; - v571 = arith.constant 4 : i32; - v572 = arith.add v568, v571 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::current_memory(v572, v560, v561, v562) - v574 = arith.constant 8 : u32; - v573 = hir.bitcast v568 : 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 : i32; - v1056 = arith.constant 0 : i32; - v563 = arith.constant 0 : i32; - v581 = arith.eq v579, v563 : i1; - v582 = arith.zext v581 : u32; - v583 = hir.bitcast v582 : i32; - v585 = arith.neq v583, v1056 : i1; - scf.if v585{ - ^block143: - scf.yield ; - } else { - ^block76: - v1055 = arith.constant 4 : u32; - v586 = hir.bitcast v568 : u32; - v588 = arith.add v586, v1055 : u32 #[overflow = checked]; - v1054 = arith.constant 4 : u32; - v590 = arith.mod v588, v1054 : u32; - hir.assertz v590 #[code = 250]; - v591 = hir.int_to_ptr v588 : ptr; - v592 = hir.load v591 : i32; - v594 = arith.constant 12 : u32; - v593 = hir.bitcast v568 : u32; - v595 = arith.add v593, v594 : u32 #[overflow = checked]; - v1053 = arith.constant 4 : u32; - v597 = arith.mod v595, v1053 : u32; - hir.assertz v597 #[code = 250]; - v598 = hir.int_to_ptr v595 : ptr; - v599 = hir.load v598 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v592, v579, v599) - scf.yield ; - }; - v1052 = arith.constant 16 : i32; - v602 = arith.add v568, v1052 : i32 #[overflow = wrapping]; - v603 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v604 = hir.bitcast v603 : ptr; - hir.store v604, v602; - builtin.ret ; + private builtin.function @std::mem::pipe_preimage_to_memory(v572: felt, v573: i32, v574: felt, v575: felt, v576: felt, v577: felt) -> i32 { + ^block73(v572: felt, v573: i32, v574: felt, v575: felt, v576: felt, v577: felt): + v578 = hir.exec @std/mem/pipe_preimage_to_memory(v572, v573, v574, v575, v576, v577) : i32 + builtin.ret v578; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v605: i32, v606: i32, v607: i32, v608: i32, v609: i32) { - ^block77(v605: i32, v606: i32, v607: i32, v608: i32, v609: i32): - v612 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v613 = hir.bitcast v612 : ptr; - v614 = hir.load v613 : i32; - v615 = arith.constant 16 : i32; - v616 = arith.sub v614, v615 : i32 #[overflow = wrapping]; - v617 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v618 = hir.bitcast v617 : ptr; - hir.store v618, v616; - v628 = hir.bitcast v606 : u32; - v629 = arith.zext v628 : u64; - v630 = hir.bitcast v629 : i64; - v610 = arith.constant 0 : i32; - v623 = arith.sub v610, v608 : i32 #[overflow = wrapping]; - v620 = arith.constant -1 : i32; - v619 = arith.add v608, v609 : i32 #[overflow = wrapping]; - v621 = arith.add v619, v620 : i32 #[overflow = wrapping]; - v624 = arith.band v621, v623 : i32; - v625 = hir.bitcast v624 : u32; - v626 = arith.zext v625 : u64; - v627 = hir.bitcast v626 : i64; - v631 = arith.mul v627, v630 : i64 #[overflow = wrapping]; - v1160 = arith.constant 0 : i32; - v632 = arith.constant 32 : i64; - v634 = hir.cast v632 : u32; - v633 = hir.bitcast v631 : u64; - v635 = arith.shr v633, v634 : u64; - v636 = hir.bitcast v635 : i64; - v637 = arith.trunc v636 : i32; - v639 = arith.neq v637, v1160 : i1; - v1072, v1073, v1074, v1075, v1076, v1077 = scf.if v639 : i32, i32, i32, i32, i32, u32 { - ^block145: - v1057 = arith.constant 0 : u32; - v1064 = ub.poison i32 : i32; - scf.yield v605, v616, v1064, v1064, v1064, v1057; + private builtin.function @::alloc_impl(v580: i32, v581: i32, v582: i32, v583: i32) { + ^block77(v580: i32, v581: i32, v582: i32, v583: i32): + v1084 = arith.constant 0 : i32; + v584 = arith.constant 0 : i32; + v585 = arith.eq v582, v584 : i1; + v586 = arith.zext v585 : u32; + v587 = hir.bitcast v586 : i32; + v589 = arith.neq v587, v1084 : i1; + v1080 = scf.if v589 : i32 { + ^block149: + scf.yield v581; } else { - ^block82: - v640 = arith.trunc v631 : i32; - v1159 = arith.constant 0 : i32; - v641 = arith.constant -2147483648 : i32; - v642 = arith.sub v641, v608 : i32 #[overflow = wrapping]; - v644 = hir.bitcast v642 : u32; - v643 = hir.bitcast v640 : u32; - v645 = arith.lte v643, v644 : i1; - v646 = arith.zext v645 : u32; - v647 = hir.bitcast v646 : i32; - v649 = arith.neq v647, v1159 : i1; - v1120 = scf.if v649 : i32 { - ^block80: - v1158 = arith.constant 0 : i32; - v660 = arith.neq v640, v1158 : i1; - v1119 = scf.if v660 : i32 { - ^block84: - v1157 = arith.constant 0 : i32; - v676 = arith.neq v607, v1157 : i1; - v1118 = scf.if v676 : i32 { - ^block87: - v658 = arith.constant 1 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v616, v608, v640, v658) - v687 = hir.bitcast v616 : u32; - v732 = arith.constant 4 : u32; - v689 = arith.mod v687, v732 : u32; - hir.assertz v689 #[code = 250]; - v690 = hir.int_to_ptr v687 : ptr; - v691 = hir.load v690 : i32; - scf.yield v691; - } else { - ^block88: - v677 = arith.constant 8 : i32; - v678 = arith.add v616, v677 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v678, v608, v640) - v662 = arith.constant 8 : u32; - v679 = hir.bitcast v616 : u32; - v681 = arith.add v679, v662 : u32 #[overflow = checked]; - v1156 = arith.constant 4 : u32; - v683 = arith.mod v681, v1156 : u32; - hir.assertz v683 #[code = 250]; - v684 = hir.int_to_ptr v681 : ptr; - v685 = hir.load v684 : i32; - scf.yield v685; - }; - v1154 = arith.constant 0 : i32; - v1155 = arith.constant 0 : i32; - v694 = arith.eq v1118, v1155 : i1; - v695 = arith.zext v694 : u32; - v696 = hir.bitcast v695 : i32; - v698 = arith.neq v696, v1154 : i1; - scf.if v698{ - ^block89: - v1153 = arith.constant 8 : u32; - v715 = hir.bitcast v605 : u32; - v717 = arith.add v715, v1153 : u32 #[overflow = checked]; - v1152 = arith.constant 4 : u32; - v719 = arith.mod v717, v1152 : u32; - hir.assertz v719 #[code = 250]; - v720 = hir.int_to_ptr v717 : ptr; - hir.store v720, v640; - v1151 = arith.constant 4 : u32; - v722 = hir.bitcast v605 : u32; - v724 = arith.add v722, v1151 : u32 #[overflow = checked]; - v1150 = arith.constant 4 : u32; - v726 = arith.mod v724, v1150 : u32; - hir.assertz v726 #[code = 250]; - v727 = hir.int_to_ptr v724 : ptr; - hir.store v727, v608; - scf.yield ; - } else { - ^block90: - v1149 = arith.constant 8 : u32; - v700 = hir.bitcast v605 : u32; - v702 = arith.add v700, v1149 : u32 #[overflow = checked]; - v1148 = arith.constant 4 : u32; - v704 = arith.mod v702, v1148 : u32; - hir.assertz v704 #[code = 250]; - v705 = hir.int_to_ptr v702 : ptr; - hir.store v705, v1118; - v1147 = arith.constant 4 : u32; - v707 = hir.bitcast v605 : u32; - v709 = arith.add v707, v1147 : u32 #[overflow = checked]; - v1146 = arith.constant 4 : u32; - v711 = arith.mod v709, v1146 : u32; - hir.assertz v711 #[code = 250]; - v712 = hir.int_to_ptr v709 : ptr; - hir.store v712, v606; - scf.yield ; - }; - v1144 = arith.constant 0 : i32; - v1145 = arith.constant 1 : i32; - v1117 = cf.select v698, v1145, v1144 : i32; - scf.yield v1117; - } else { - ^block85: - v1143 = arith.constant 8 : u32; - v661 = hir.bitcast v605 : u32; - v663 = arith.add v661, v1143 : u32 #[overflow = checked]; - v1142 = arith.constant 4 : u32; - v665 = arith.mod v663, v1142 : u32; - hir.assertz v665 #[code = 250]; - v666 = hir.int_to_ptr v663 : ptr; - hir.store v666, v608; - v1141 = arith.constant 4 : u32; - v669 = hir.bitcast v605 : u32; - v671 = arith.add v669, v1141 : u32 #[overflow = checked]; - v1140 = arith.constant 4 : u32; - v673 = arith.mod v671, v1140 : u32; - hir.assertz v673 #[code = 250]; - v1139 = arith.constant 0 : i32; - v674 = hir.int_to_ptr v671 : ptr; - hir.store v674, v1139; - v1138 = arith.constant 0 : i32; - scf.yield v1138; - }; - scf.yield v1119; + ^block80: + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v1083 = arith.constant 0 : i32; + v591 = arith.neq v583, v1083 : i1; + v1079 = scf.if v591 : i32 { + ^block81: + v593 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v582, v581) : i32 + scf.yield v593; } else { - ^block83: - v1137 = ub.poison i32 : i32; - scf.yield v1137; + ^block82: + v592 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v582, v581) : i32 + scf.yield v592; }; - v1132 = arith.constant 0 : u32; - v1065 = arith.constant 1 : u32; - v1125 = cf.select v649, v1065, v1132 : u32; - v1133 = ub.poison i32 : i32; - v1124 = cf.select v649, v616, v1133 : i32; - v1134 = ub.poison i32 : i32; - v1123 = cf.select v649, v605, v1134 : i32; - v1135 = ub.poison i32 : i32; - v1122 = cf.select v649, v1135, v616 : i32; - v1136 = ub.poison i32 : i32; - v1121 = cf.select v649, v1136, v605 : i32; - scf.yield v1121, v1122, v1123, v1120, v1124, v1125; + scf.yield v1079; }; - v1078, v1079, v1080 = scf.index_switch v1077 : i32, i32, i32 - case 0 { - ^block81: - v1131 = arith.constant 4 : u32; - v652 = hir.bitcast v1072 : u32; - v654 = arith.add v652, v1131 : u32 #[overflow = checked]; - v1130 = arith.constant 4 : u32; - v656 = arith.mod v654, v1130 : u32; - hir.assertz v656 #[code = 250]; - v1129 = arith.constant 0 : i32; - v657 = hir.int_to_ptr v654 : ptr; - hir.store v657, v1129; - v1128 = arith.constant 1 : i32; - scf.yield v1072, v1128, v1073; - } - default { - ^block149: - scf.yield v1074, v1075, v1076; - }; - v731 = hir.bitcast v1078 : u32; - v1127 = arith.constant 4 : u32; - v733 = arith.mod v731, v1127 : u32; - hir.assertz v733 #[code = 250]; - v734 = hir.int_to_ptr v731 : ptr; - hir.store v734, v1079; - v1126 = arith.constant 16 : i32; - v739 = arith.add v1080, v1126 : i32 #[overflow = wrapping]; - v740 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v741 = hir.bitcast v740 : ptr; - hir.store v741, v739; - builtin.ret ; - }; - - private builtin.function @::allocate(v742: i32, v743: i32, v744: i32) { - ^block91(v742: i32, v743: i32, v744: i32): - v746 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v747 = hir.bitcast v746 : ptr; - v748 = hir.load v747 : i32; - v749 = arith.constant 16 : i32; - v750 = arith.sub v748, v749 : i32 #[overflow = wrapping]; - v751 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v752 = hir.bitcast v751 : ptr; - hir.store v752, v750; - v745 = arith.constant 0 : i32; - v753 = arith.constant 8 : i32; - v754 = arith.add v750, v753 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v754, v743, v744, v745) - v757 = arith.constant 12 : u32; - v756 = hir.bitcast v750 : u32; - v758 = arith.add v756, v757 : u32 #[overflow = checked]; - v759 = arith.constant 4 : u32; - v760 = arith.mod v758, v759 : u32; - hir.assertz v760 #[code = 250]; - v761 = hir.int_to_ptr v758 : ptr; - v762 = hir.load v761 : i32; - v764 = arith.constant 8 : u32; - v763 = hir.bitcast v750 : u32; - v765 = arith.add v763, v764 : u32 #[overflow = checked]; - v1165 = arith.constant 4 : u32; - v767 = arith.mod v765, v1165 : u32; - hir.assertz v767 #[code = 250]; - v768 = hir.int_to_ptr v765 : ptr; - v769 = hir.load v768 : i32; - v770 = hir.bitcast v742 : u32; - v1164 = arith.constant 4 : u32; - v772 = arith.mod v770, v1164 : u32; - hir.assertz v772 #[code = 250]; - v773 = hir.int_to_ptr v770 : ptr; - hir.store v773, v769; - v1163 = arith.constant 4 : u32; - v774 = hir.bitcast v742 : u32; - v776 = arith.add v774, v1163 : u32 #[overflow = checked]; - v1162 = arith.constant 4 : u32; - v778 = arith.mod v776, v1162 : u32; - hir.assertz v778 #[code = 250]; - v779 = hir.int_to_ptr v776 : ptr; - hir.store v779, v762; - v1161 = arith.constant 16 : i32; - v781 = arith.add v750, v1161 : i32 #[overflow = wrapping]; - v782 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v783 = hir.bitcast v782 : ptr; - hir.store v783, v781; + v597 = arith.constant 4 : u32; + v596 = hir.bitcast v580 : u32; + v598 = arith.add v596, v597 : u32 #[overflow = checked]; + v1082 = arith.constant 4 : u32; + v600 = arith.mod v598, v1082 : u32; + hir.assertz v600 #[code = 250]; + v601 = hir.int_to_ptr v598 : ptr; + hir.store v601, v582; + v603 = hir.bitcast v580 : u32; + v1081 = arith.constant 4 : u32; + v605 = arith.mod v603, v1081 : u32; + hir.assertz v605 #[code = 250]; + v606 = hir.int_to_ptr v603 : ptr; + hir.store v606, v1080; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v784: i32, v785: i32, v786: i32, v787: i32) { - ^block93(v784: i32, v785: i32, v786: i32, v787: i32): - v1181 = arith.constant 0 : i32; - v788 = arith.constant 0 : i32; - v789 = arith.eq v786, v788 : i1; - v790 = arith.zext v789 : u32; - v791 = hir.bitcast v790 : i32; - v793 = arith.neq v791, v1181 : i1; - v1177 = scf.if v793 : i32 { + private builtin.function @::deallocate(v607: i32, v608: i32, v609: i32) { + ^block83(v607: i32, v608: i32, v609: i32): + v611 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v612 = hir.bitcast v611 : ptr; + v613 = hir.load v612 : i32; + v614 = arith.constant 16 : i32; + v615 = arith.sub v613, v614 : i32 #[overflow = wrapping]; + v616 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v617 = hir.bitcast v616 : ptr; + hir.store v617, v615; + v618 = arith.constant 4 : i32; + v619 = arith.add v615, v618 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::current_memory(v619, v607, v608, v609) + v621 = arith.constant 8 : u32; + v620 = hir.bitcast v615 : u32; + v622 = arith.add v620, v621 : u32 #[overflow = checked]; + v623 = arith.constant 4 : u32; + v624 = arith.mod v622, v623 : u32; + hir.assertz v624 #[code = 250]; + v625 = hir.int_to_ptr v622 : ptr; + v626 = hir.load v625 : i32; + v1091 = arith.constant 0 : i32; + v610 = arith.constant 0 : i32; + v628 = arith.eq v626, v610 : i1; + v629 = arith.zext v628 : u32; + v630 = hir.bitcast v629 : i32; + v632 = arith.neq v630, v1091 : i1; + scf.if v632{ ^block152: - scf.yield v785; + scf.yield ; } else { - ^block96: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1180 = arith.constant 0 : i32; - v795 = arith.neq v787, v1180 : i1; - v1176 = scf.if v795 : i32 { - ^block97: - v797 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v786, v785) : i32 - scf.yield v797; - } else { - ^block98: - v796 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v786, v785) : i32 - scf.yield v796; - }; - scf.yield v1176; + ^block86: + v1090 = arith.constant 4 : u32; + v633 = hir.bitcast v615 : u32; + v635 = arith.add v633, v1090 : u32 #[overflow = checked]; + v1089 = arith.constant 4 : u32; + v637 = arith.mod v635, v1089 : u32; + hir.assertz v637 #[code = 250]; + v638 = hir.int_to_ptr v635 : ptr; + v639 = hir.load v638 : i32; + v641 = arith.constant 12 : u32; + v640 = hir.bitcast v615 : u32; + v642 = arith.add v640, v641 : u32 #[overflow = checked]; + v1088 = arith.constant 4 : u32; + v644 = arith.mod v642, v1088 : u32; + hir.assertz v644 #[code = 250]; + v645 = hir.int_to_ptr v642 : ptr; + v646 = hir.load v645 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v639, v626, v646) + scf.yield ; }; - v801 = arith.constant 4 : u32; - v800 = hir.bitcast v784 : u32; - v802 = arith.add v800, v801 : u32 #[overflow = checked]; - v1179 = arith.constant 4 : u32; - v804 = arith.mod v802, v1179 : u32; - hir.assertz v804 #[code = 250]; - v805 = hir.int_to_ptr v802 : ptr; - hir.store v805, v786; - v807 = hir.bitcast v784 : u32; - v1178 = arith.constant 4 : u32; - v809 = arith.mod v807, v1178 : u32; - hir.assertz v809 #[code = 250]; - v810 = hir.int_to_ptr v807 : ptr; - hir.store v810, v1177; + v1087 = arith.constant 16 : i32; + v649 = arith.add v615, v1087 : i32 #[overflow = wrapping]; + v650 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v651 = hir.bitcast v650 : ptr; + hir.store v651, v649; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v811: i32, v812: i32, v813: i32, v814: i32) { - ^block99(v811: i32, v812: i32, v813: i32, v814: i32): - v1207 = arith.constant 0 : i32; - v815 = arith.constant 0 : i32; - v819 = arith.eq v814, v815 : i1; - v820 = arith.zext v819 : u32; - v821 = hir.bitcast v820 : i32; - v823 = arith.neq v821, v1207 : i1; - v1194, v1195 = scf.if v823 : i32, i32 { - ^block156: - v1206 = arith.constant 0 : i32; - v817 = arith.constant 4 : i32; - scf.yield v817, v1206; + private builtin.function @::current_memory(v652: i32, v653: i32, v654: i32, v655: i32) { + ^block87(v652: i32, v653: i32, v654: i32, v655: i32): + v1117 = arith.constant 0 : i32; + v656 = arith.constant 0 : i32; + v660 = arith.eq v655, v656 : i1; + v661 = arith.zext v660 : u32; + v662 = hir.bitcast v661 : i32; + v664 = arith.neq v662, v1117 : i1; + v1104, v1105 = scf.if v664 : i32, i32 { + ^block155: + v1116 = arith.constant 0 : i32; + v658 = arith.constant 4 : i32; + scf.yield v658, v1116; } else { - ^block102: - v824 = hir.bitcast v812 : u32; - v859 = arith.constant 4 : u32; - v826 = arith.mod v824, v859 : u32; - hir.assertz v826 #[code = 250]; - v827 = hir.int_to_ptr v824 : ptr; - v828 = hir.load v827 : i32; - v1204 = arith.constant 0 : i32; - v1205 = arith.constant 0 : i32; - v830 = arith.eq v828, v1205 : i1; - v831 = arith.zext v830 : u32; - v832 = hir.bitcast v831 : i32; - v834 = arith.neq v832, v1204 : i1; - v1192 = scf.if v834 : i32 { - ^block155: - v1203 = arith.constant 0 : i32; - scf.yield v1203; + ^block90: + v665 = hir.bitcast v653 : u32; + v700 = arith.constant 4 : u32; + v667 = arith.mod v665, v700 : u32; + hir.assertz v667 #[code = 250]; + v668 = hir.int_to_ptr v665 : ptr; + v669 = hir.load v668 : i32; + v1114 = arith.constant 0 : i32; + v1115 = arith.constant 0 : i32; + v671 = arith.eq v669, v1115 : i1; + v672 = arith.zext v671 : u32; + v673 = hir.bitcast v672 : i32; + v675 = arith.neq v673, v1114 : i1; + v1102 = scf.if v675 : i32 { + ^block154: + v1113 = arith.constant 0 : i32; + scf.yield v1113; } else { - ^block103: - v1202 = arith.constant 4 : u32; - v835 = hir.bitcast v811 : u32; - v837 = arith.add v835, v1202 : u32 #[overflow = checked]; - v1201 = arith.constant 4 : u32; - v839 = arith.mod v837, v1201 : u32; - hir.assertz v839 #[code = 250]; - v840 = hir.int_to_ptr v837 : ptr; - hir.store v840, v813; - v1200 = arith.constant 4 : u32; - v841 = hir.bitcast v812 : u32; - v843 = arith.add v841, v1200 : u32 #[overflow = checked]; - v1199 = arith.constant 4 : u32; - v845 = arith.mod v843, v1199 : u32; - hir.assertz v845 #[code = 250]; - v846 = hir.int_to_ptr v843 : ptr; - v847 = hir.load v846 : i32; - v848 = hir.bitcast v811 : u32; - v1198 = arith.constant 4 : u32; - v850 = arith.mod v848, v1198 : u32; - hir.assertz v850 #[code = 250]; - v851 = hir.int_to_ptr v848 : ptr; - hir.store v851, v847; - v852 = arith.mul v828, v814 : i32 #[overflow = wrapping]; - scf.yield v852; + ^block91: + v1112 = arith.constant 4 : u32; + v676 = hir.bitcast v652 : u32; + v678 = arith.add v676, v1112 : u32 #[overflow = checked]; + v1111 = arith.constant 4 : u32; + v680 = arith.mod v678, v1111 : u32; + hir.assertz v680 #[code = 250]; + v681 = hir.int_to_ptr v678 : ptr; + hir.store v681, v654; + v1110 = arith.constant 4 : u32; + v682 = hir.bitcast v653 : u32; + v684 = arith.add v682, v1110 : u32 #[overflow = checked]; + v1109 = arith.constant 4 : u32; + v686 = arith.mod v684, v1109 : u32; + hir.assertz v686 #[code = 250]; + v687 = hir.int_to_ptr v684 : ptr; + v688 = hir.load v687 : i32; + v689 = hir.bitcast v652 : u32; + v1108 = arith.constant 4 : u32; + v691 = arith.mod v689, v1108 : u32; + hir.assertz v691 #[code = 250]; + v692 = hir.int_to_ptr v689 : ptr; + hir.store v692, v688; + v693 = arith.mul v669, v655 : i32 #[overflow = wrapping]; + scf.yield v693; }; - v853 = arith.constant 8 : i32; - v1197 = arith.constant 4 : i32; - v1193 = cf.select v834, v1197, v853 : i32; - scf.yield v1193, v1192; + v694 = arith.constant 8 : i32; + v1107 = arith.constant 4 : i32; + v1103 = cf.select v675, v1107, v694 : i32; + scf.yield v1103, v1102; }; - v856 = arith.add v811, v1194 : i32 #[overflow = wrapping]; - v858 = hir.bitcast v856 : u32; - v1196 = arith.constant 4 : u32; - v860 = arith.mod v858, v1196 : u32; - hir.assertz v860 #[code = 250]; - v861 = hir.int_to_ptr v858 : ptr; - hir.store v861, v1195; + v697 = arith.add v652, v1104 : i32 #[overflow = wrapping]; + v699 = hir.bitcast v697 : u32; + v1106 = arith.constant 4 : u32; + v701 = arith.mod v699, v1106 : u32; + hir.assertz v701 #[code = 250]; + v702 = hir.int_to_ptr v699 : ptr; + hir.store v702, v1105; builtin.ret ; }; - private builtin.function @::deallocate(v862: i32, v863: i32, v864: i32) { - ^block104(v862: i32, v863: i32, v864: i32): - v1209 = arith.constant 0 : i32; - v865 = arith.constant 0 : i32; - v866 = arith.eq v864, v865 : i1; - v867 = arith.zext v866 : u32; - v868 = hir.bitcast v867 : i32; - v870 = arith.neq v868, v1209 : i1; - scf.if v870{ - ^block106: + private builtin.function @::deallocate(v703: i32, v704: i32, v705: i32) { + ^block92(v703: i32, v704: i32, v705: i32): + v1119 = arith.constant 0 : i32; + v706 = arith.constant 0 : i32; + v707 = arith.eq v705, v706 : i1; + v708 = arith.zext v707 : u32; + v709 = hir.bitcast v708 : i32; + v711 = arith.neq v709, v1119 : i1; + scf.if v711{ + ^block94: scf.yield ; } else { - ^block107: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v862, v864, v863) + ^block95: + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v703, v705, v704) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v871: i32, v872: i32, v873: i32) { - ^block108(v871: i32, v872: i32, v873: i32): + private builtin.function @::allocate(v712: i32, v713: i32, v714: i32) { + ^block96(v712: i32, v713: i32, v714: i32): + v716 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v717 = hir.bitcast v716 : ptr; + v718 = hir.load v717 : i32; + v719 = arith.constant 16 : i32; + v720 = arith.sub v718, v719 : i32 #[overflow = wrapping]; + v721 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v722 = hir.bitcast v721 : ptr; + hir.store v722, v720; + v715 = arith.constant 0 : i32; + v723 = arith.constant 8 : i32; + v724 = arith.add v720, v723 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v724, v713, v714, v715) + v727 = arith.constant 12 : u32; + v726 = hir.bitcast v720 : u32; + v728 = arith.add v726, v727 : u32 #[overflow = checked]; + v729 = arith.constant 4 : u32; + v730 = arith.mod v728, v729 : u32; + hir.assertz v730 #[code = 250]; + v731 = hir.int_to_ptr v728 : ptr; + v732 = hir.load v731 : i32; + v734 = arith.constant 8 : u32; + v733 = hir.bitcast v720 : u32; + v735 = arith.add v733, v734 : u32 #[overflow = checked]; + v1124 = arith.constant 4 : u32; + v737 = arith.mod v735, v1124 : u32; + hir.assertz v737 #[code = 250]; + v738 = hir.int_to_ptr v735 : ptr; + v739 = hir.load v738 : i32; + v740 = hir.bitcast v712 : u32; + v1123 = arith.constant 4 : u32; + v742 = arith.mod v740, v1123 : u32; + hir.assertz v742 #[code = 250]; + v743 = hir.int_to_ptr v740 : ptr; + hir.store v743, v739; + v1122 = arith.constant 4 : u32; + v744 = hir.bitcast v712 : u32; + v746 = arith.add v744, v1122 : u32 #[overflow = checked]; + v1121 = arith.constant 4 : u32; + v748 = arith.mod v746, v1121 : u32; + hir.assertz v748 #[code = 250]; + v749 = hir.int_to_ptr v746 : ptr; + hir.store v749, v732; + v1120 = arith.constant 16 : i32; + v751 = arith.add v720, v1120 : i32 #[overflow = wrapping]; + v752 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v753 = hir.bitcast v752 : ptr; + hir.store v753, v751; + builtin.ret ; + }; + + private builtin.function @::try_allocate_in(v754: i32, v755: i32, v756: i32, v757: i32, v758: i32) { + ^block98(v754: i32, v755: i32, v756: i32, v757: i32, v758: i32): + v761 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v762 = hir.bitcast v761 : ptr; + v763 = hir.load v762 : i32; + v764 = arith.constant 16 : i32; + v765 = arith.sub v763, v764 : i32 #[overflow = wrapping]; + v766 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v767 = hir.bitcast v766 : ptr; + hir.store v767, v765; + v777 = hir.bitcast v755 : u32; + v778 = arith.zext v777 : u64; + v779 = hir.bitcast v778 : i64; + v759 = arith.constant 0 : i32; + v772 = arith.sub v759, v757 : i32 #[overflow = wrapping]; + v769 = arith.constant -1 : i32; + v768 = arith.add v757, v758 : i32 #[overflow = wrapping]; + v770 = arith.add v768, v769 : i32 #[overflow = wrapping]; + v773 = arith.band v770, v772 : i32; + v774 = hir.bitcast v773 : u32; + v775 = arith.zext v774 : u64; + v776 = hir.bitcast v775 : i64; + v780 = arith.mul v776, v779 : i64 #[overflow = wrapping]; + v1227 = arith.constant 0 : i32; + v781 = arith.constant 32 : i64; + v783 = hir.cast v781 : u32; + v782 = hir.bitcast v780 : u64; + v784 = arith.shr v782, v783 : u64; + v785 = hir.bitcast v784 : i64; + v786 = arith.trunc v785 : i32; + v788 = arith.neq v786, v1227 : i1; + v1140, v1141, v1142, v1143, v1144, v1145 = scf.if v788 : i32, i32, i32, i32, i32, u32 { + ^block159: + v1125 = arith.constant 0 : u32; + v1132 = ub.poison i32 : i32; + scf.yield v754, v765, v1132, v1132, v1132, v1125; + } else { + ^block103: + v789 = arith.trunc v780 : i32; + v1226 = arith.constant 0 : i32; + v790 = arith.constant -2147483648 : i32; + v791 = arith.sub v790, v757 : i32 #[overflow = wrapping]; + v793 = hir.bitcast v791 : u32; + v792 = hir.bitcast v789 : u32; + v794 = arith.lte v792, v793 : i1; + v795 = arith.zext v794 : u32; + v796 = hir.bitcast v795 : i32; + v798 = arith.neq v796, v1226 : i1; + v1188 = scf.if v798 : i32 { + ^block101: + v1225 = arith.constant 0 : i32; + v809 = arith.neq v789, v1225 : i1; + v1187 = scf.if v809 : i32 { + ^block105: + v1224 = arith.constant 0 : i32; + v825 = arith.neq v756, v1224 : i1; + v1186 = scf.if v825 : i32 { + ^block108: + v807 = arith.constant 1 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v765, v757, v789, v807) + v836 = hir.bitcast v765 : u32; + v877 = arith.constant 4 : u32; + v838 = arith.mod v836, v877 : u32; + hir.assertz v838 #[code = 250]; + v839 = hir.int_to_ptr v836 : ptr; + v840 = hir.load v839 : i32; + scf.yield v840; + } else { + ^block109: + v826 = arith.constant 8 : i32; + v827 = arith.add v765, v826 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v827, v757, v789) + v811 = arith.constant 8 : u32; + v828 = hir.bitcast v765 : u32; + v830 = arith.add v828, v811 : u32 #[overflow = checked]; + v1223 = arith.constant 4 : u32; + v832 = arith.mod v830, v1223 : u32; + hir.assertz v832 #[code = 250]; + v833 = hir.int_to_ptr v830 : ptr; + v834 = hir.load v833 : i32; + scf.yield v834; + }; + v1222 = arith.constant 0 : i32; + v843 = arith.neq v1186, v1222 : i1; + scf.if v843{ + ^block110: + v1221 = arith.constant 8 : u32; + v860 = hir.bitcast v754 : u32; + v862 = arith.add v860, v1221 : u32 #[overflow = checked]; + v1220 = arith.constant 4 : u32; + v864 = arith.mod v862, v1220 : u32; + hir.assertz v864 #[code = 250]; + v865 = hir.int_to_ptr v862 : ptr; + hir.store v865, v1186; + v1219 = arith.constant 4 : u32; + v867 = hir.bitcast v754 : u32; + v869 = arith.add v867, v1219 : u32 #[overflow = checked]; + v1218 = arith.constant 4 : u32; + v871 = arith.mod v869, v1218 : u32; + hir.assertz v871 #[code = 250]; + v872 = hir.int_to_ptr v869 : ptr; + hir.store v872, v755; + scf.yield ; + } else { + ^block111: + v1217 = arith.constant 8 : u32; + v846 = hir.bitcast v754 : u32; + v848 = arith.add v846, v1217 : u32 #[overflow = checked]; + v1216 = arith.constant 4 : u32; + v850 = arith.mod v848, v1216 : u32; + hir.assertz v850 #[code = 250]; + v851 = hir.int_to_ptr v848 : ptr; + hir.store v851, v789; + v1215 = arith.constant 4 : u32; + v853 = hir.bitcast v754 : u32; + v855 = arith.add v853, v1215 : u32 #[overflow = checked]; + v1214 = arith.constant 4 : u32; + v857 = arith.mod v855, v1214 : u32; + hir.assertz v857 #[code = 250]; + v858 = hir.int_to_ptr v855 : ptr; + hir.store v858, v757; + scf.yield ; + }; + v1212 = arith.constant 1 : i32; + v1213 = arith.constant 0 : i32; + v1185 = cf.select v843, v1213, v1212 : i32; + scf.yield v1185; + } else { + ^block106: + v1211 = arith.constant 8 : u32; + v810 = hir.bitcast v754 : u32; + v812 = arith.add v810, v1211 : u32 #[overflow = checked]; + v1210 = arith.constant 4 : u32; + v814 = arith.mod v812, v1210 : u32; + hir.assertz v814 #[code = 250]; + v815 = hir.int_to_ptr v812 : ptr; + hir.store v815, v757; + v1209 = arith.constant 4 : u32; + v818 = hir.bitcast v754 : u32; + v820 = arith.add v818, v1209 : u32 #[overflow = checked]; + v1208 = arith.constant 4 : u32; + v822 = arith.mod v820, v1208 : u32; + hir.assertz v822 #[code = 250]; + v1207 = arith.constant 0 : i32; + v823 = hir.int_to_ptr v820 : ptr; + hir.store v823, v1207; + v1206 = arith.constant 0 : i32; + scf.yield v1206; + }; + scf.yield v1187; + } else { + ^block104: + v1205 = ub.poison i32 : i32; + scf.yield v1205; + }; + v1200 = arith.constant 0 : u32; + v1133 = arith.constant 1 : u32; + v1193 = cf.select v798, v1133, v1200 : u32; + v1201 = ub.poison i32 : i32; + v1192 = cf.select v798, v765, v1201 : i32; + v1202 = ub.poison i32 : i32; + v1191 = cf.select v798, v754, v1202 : i32; + v1203 = ub.poison i32 : i32; + v1190 = cf.select v798, v1203, v765 : i32; + v1204 = ub.poison i32 : i32; + v1189 = cf.select v798, v1204, v754 : i32; + scf.yield v1189, v1190, v1191, v1188, v1192, v1193; + }; + v1146, v1147, v1148 = scf.index_switch v1145 : i32, i32, i32 + case 0 { + ^block102: + v1199 = arith.constant 4 : u32; + v801 = hir.bitcast v1140 : u32; + v803 = arith.add v801, v1199 : u32 #[overflow = checked]; + v1198 = arith.constant 4 : u32; + v805 = arith.mod v803, v1198 : u32; + hir.assertz v805 #[code = 250]; + v1197 = arith.constant 0 : i32; + v806 = hir.int_to_ptr v803 : ptr; + hir.store v806, v1197; + v1196 = arith.constant 1 : i32; + scf.yield v1140, v1196, v1141; + } + default { + ^block163: + scf.yield v1142, v1143, v1144; + }; + v876 = hir.bitcast v1146 : u32; + v1195 = arith.constant 4 : u32; + v878 = arith.mod v876, v1195 : u32; + hir.assertz v878 #[code = 250]; + v879 = hir.int_to_ptr v876 : ptr; + hir.store v879, v1147; + v1194 = arith.constant 16 : i32; + v884 = arith.add v1148, v1194 : i32 #[overflow = wrapping]; + v885 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v886 = hir.bitcast v885 : ptr; + hir.store v886, v884; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v887: i32, v888: i32) { + ^block112(v887: i32, v888: i32): ub.unreachable ; }; - private builtin.function @core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v874: i32, v875: i32, v876: i32) { - ^block110(v874: i32, v875: i32, v876: i32): + private builtin.function @core::slice::index::slice_index_fail::do_panic::runtime(v889: i32, v890: i32, v891: i32) { + ^block114(v889: i32, v890: i32, v891: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v877: i32, v878: i32) -> i32 { - ^block112(v877: i32, v878: i32): - v885 = arith.constant 0 : i32; - v881 = hir.bitcast v878 : u32; - v880 = hir.bitcast v877 : u32; - v882 = arith.gt v880, v881 : i1; - v883 = arith.zext v882 : u32; - v884 = hir.bitcast v883 : i32; - v886 = arith.neq v884, v885 : i1; - v887 = cf.select v886, v877, v878 : i32; - builtin.ret v887; + private builtin.function @::max(v892: i32, v893: i32) -> i32 { + ^block116(v892: i32, v893: i32): + v900 = arith.constant 0 : i32; + v896 = hir.bitcast v893 : u32; + v895 = hir.bitcast v892 : u32; + v897 = arith.gt v895, v896 : i1; + v898 = arith.zext v897 : u32; + v899 = hir.bitcast v898 : i32; + v901 = arith.neq v899, v900 : i1; + v902 = cf.select v901, v892, v893 : i32; + builtin.ret v902; }; - private builtin.function @miden::output_note::create(v888: felt, v889: felt, v890: felt, v891: felt, v892: felt, v893: felt, v894: felt, v895: felt) -> felt { - ^block114(v888: felt, v889: felt, v890: felt, v891: felt, v892: felt, v893: felt, v894: felt, v895: felt): - v896 = hir.exec @miden/output_note/create(v888, v889, v890, v891, v892, v893, v894, v895) : felt - builtin.ret v896; + private builtin.function @miden::output_note::create(v903: felt, v904: felt, v905: felt, v906: felt, v907: felt, v908: felt, v909: felt, v910: felt) -> felt { + ^block118(v903: felt, v904: felt, v905: felt, v906: felt, v907: felt, v908: felt, v909: felt, v910: felt): + v911 = hir.exec @miden/output_note/create(v903, v904, v905, v906, v907, v908, v909, v910) : felt + builtin.ret v911; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1259,9 +1290,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v898: felt, v899: felt, v900: felt, v901: felt) { - ^block118(v898: felt, v899: felt, v900: felt, v901: felt): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v898, v899, v900, v901) + public builtin.function @run(v913: felt, v914: felt, v915: felt, v916: felt) { + ^block122(v913: felt, v914: felt, v915: felt, v916: felt): + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v913, v914, v915, v916) 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 3a78841d9..2c405257d 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -57,10 +57,7 @@ proc __wasm_call_ctors( end @callconv("C") -proc core::slice::index::slice_end_index_len_fail( - i32, - i32 -) +proc __rustc::__rust_alloc(i32, i32) -> i32 push.1114180 u32divmod.4 swap.1 @@ -69,20 +66,193 @@ proc core::slice::index::slice_end_index_len_fail( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 + push.1048616 u32wrapping_add - movdn.2 + movup.2 + swap.1 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048616 + u32wrapping_add + dup.1 + swap.2 + swap.3 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::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") +proc basic_wallet_tx_script::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc core::slice::index::slice_index_fail(i32, i32, i32) + push.0 + dup.3 + dup.2 + swap.1 + u32gt + neq + if.true + swap.1 + drop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + movdn.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 + trace.252 + nop + else + drop + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + if.true + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + movdn.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 + trace.252 + nop + else + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + movdn.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 + trace.252 + nop + end + end + push.0 assert end @callconv("C") -proc as core::ops::index::Index>::index( +proc as core::ops::index::Index>>::index( i32, i32, i32, @@ -173,14 +343,13 @@ proc as core::ops::index::Index>::index( trace.252 nop else - movdn.3 - drop + movdn.2 drop drop - swap.1 + movdn.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::index::slice_end_index_len_fail + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::index::slice_index_fail trace.252 nop push.0 @@ -189,8 +358,8 @@ proc as core::ops::index::Index>::index( end @callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114180 +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + push.1114176 u32divmod.4 swap.1 trace.240 @@ -198,180 +367,60 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048616 - u32wrapping_add - movup.2 + push.80 + u32wrapping_sub + push.1114176 + dup.1 + swap.1 + u32divmod.4 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 -end - -@callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114180 - u32divmod.4 - swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::wit_bindgen::rt::run_ctors_once trace.252 nop - push.1048616 - u32wrapping_add dup.1 - swap.2 - swap.3 - swap.1 + dup.3 + dup.5 + dup.7 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::intrinsics::advice::adv_push_mapvaln + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::as_u64 + trace.252 + nop + push.3 + dup.2 + dup.2 + drop + u32and + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 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") -proc basic_wallet_tx_script::bindings::__link_custom_section_describing_imports( - -) - nop -end - -@callconv("C") -proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.80 - u32wrapping_sub - push.1114176 - dup.1 - swap.1 - u32divmod.4 - 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::wit_bindgen::rt::run_ctors_once - trace.252 - nop - dup.1 - dup.3 - dup.5 - dup.7 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::advice::adv_push_mapvaln - trace.252 - nop - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::as_u64 - trace.252 - nop - push.3 - dup.2 - dup.2 - drop - u32and - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 - trace.252 - nop - push.0 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::assert_eq - trace.252 - nop - push.2 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::assert_eq + trace.252 + nop + push.2 push.0 dup.0 push.2147483648 @@ -418,7 +467,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::alloc::raw_vec::RawVecInner::try_allocate_in + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::try_allocate_in trace.252 nop push.68 @@ -472,16 +521,8 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop movup.2 drop - push.1114180 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.72 - movup.3 + movup.2 add u32assert push.4 @@ -497,10 +538,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 - movup.2 - u32wrapping_add - swap.2 + swap.1 trace.240 nop exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::alloc::raw_vec::handle_error @@ -689,7 +727,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) 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 push.12 @@ -736,7 +774,9 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 + push.8 + dup.1 + u32wrapping_add push.4 dup.1 swap.1 @@ -752,9 +792,11 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop swap.1 push.8 - movup.3 + push.32 + dup.9 u32wrapping_add - push.4 + u32wrapping_add + push.8 dup.1 swap.1 u32mod @@ -762,18 +804,14 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_dw trace.252 nop - swap.1 - push.8 - push.32 - dup.10 - u32wrapping_add - u32wrapping_add - push.8 + push.4 dup.1 swap.1 u32mod @@ -781,13 +819,12 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) 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 + swap.1 push.32 dup.7 add @@ -835,7 +872,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) dup.4 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 push.4 @@ -880,7 +917,9 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 + push.8 + dup.1 + u32wrapping_add push.4 dup.1 swap.1 @@ -896,9 +935,11 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop swap.1 push.8 - movup.3 + push.48 + dup.7 u32wrapping_add - push.4 + u32wrapping_add + push.8 dup.1 swap.1 u32mod @@ -906,18 +947,14 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_dw trace.252 nop - swap.1 - push.8 - push.48 - dup.8 - u32wrapping_add - u32wrapping_add - push.8 + push.4 dup.1 swap.1 u32mod @@ -925,13 +962,12 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) 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 + swap.1 push.48 dup.5 add @@ -1051,7 +1087,7 @@ 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::RawVecInner::deallocate + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::deallocate trace.252 nop push.80 @@ -1195,7 +1231,7 @@ proc ::alloc( movup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::ptr::alignment::Alignment::max + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::max trace.252 nop push.0 @@ -1519,24 +1555,12 @@ proc felt - dup.1 - dup.1 - push.1 - push.4294967295 +proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt trace.240 nop - exec.::std::math::u64::lt + exec.::intrinsics::advice::adv_push_mapvaln trace.252 nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop end @callconv("C") @@ -1550,12 +1574,24 @@ proc intrinsics::felt::assert_eq(felt, felt) end @callconv("C") -proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt +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.::intrinsics::advice::adv_push_mapvaln + exec.::std::math::u64::lt trace.252 nop + assert + mul.4294967296 + add end @callconv("C") @@ -1568,48 +1604,126 @@ proc std::mem::pipe_preimage_to_memory(felt, i32, felt, felt, felt, felt) -> i32 end @callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +proc ::alloc_impl( + i32, i32, i32, i32 ) - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114176 - 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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.8 - dup.1 - add - u32assert + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__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.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114176 + 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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::current_memory + trace.252 + nop + push.8 + dup.1 + add + u32assert push.4 dup.1 swap.1 @@ -1685,393 +1799,122 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( - i32, +proc ::current_memory( i32, i32, i32, i32 ) - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114176 - 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 + dup.5 + eq neq if.true + movdn.3 drop drop - movup.2 - drop - movup.2 - drop - movup.2 drop push.0 - push.3735929054 - dup.0 + push.4 + else + dup.1 + push.4 dup.1 - swap.4 swap.1 - swap.3 - swap.5 - else - drop + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 push.0 - push.2147483648 - dup.7 - u32wrapping_sub dup.2 - swap.1 - u32lte + eq neq dup.0 if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop 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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::alloc::alloc::Global::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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::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 - push.0 - dup.2 - eq - neq - dup.0 - if.true - 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 - else - 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 - end - push.0 - push.1 - 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 + 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 - 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.8 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 + movup.3 + cdrop end + movup.2 + u32wrapping_add push.4 dup.1 swap.1 @@ -2085,16 +1928,32 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - push.16 - u32wrapping_add - push.1114176 - 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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_dealloc + trace.252 + nop + end end @callconv("C") @@ -2136,7 +1995,7 @@ proc ::allocate( swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::alloc::alloc::Global::alloc_impl + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::alloc_impl trace.252 nop push.12 @@ -2211,206 +2070,397 @@ proc ::allocate( swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + push.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114176 + 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 -end - -@callconv("C") -proc alloc::alloc::Global::alloc_impl( - i32, - i32, - i32, - i32 -) push.0 + push.32 push.0 - dup.4 - eq + 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 - movup.3 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 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop + drop push.0 - movup.4 + push.2147483648 + dup.7 + u32wrapping_sub + dup.2 + swap.1 + u32lte neq + dup.0 if.true - swap.1 + push.0 dup.2 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_alloc_zeroed - trace.252 - nop + neq + if.true + push.0 + movup.6 + neq + if.true + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::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 - dup.2 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_alloc - trace.252 - nop + 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 - 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 alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq + movup.5 + eq.0 if.true - movdn.3 + movup.2 drop + movup.2 drop + movup.2 drop - push.0 push.4 - else 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::load_sw + exec.::intrinsics::mem::store_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 + push.1 + swap.1 + else + drop + drop end - movup.2 - u32wrapping_add push.4 dup.1 swap.1 @@ -2424,37 +2474,20 @@ proc alloc::raw_vec::RawVecInner::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + push.16 + u32wrapping_add + push.1114176 + 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.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_dealloc - trace.252 - nop - end -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop +proc alloc::raw_vec::handle_error(i32, i32) drop drop push.0 @@ -2462,7 +2495,7 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) end @callconv("C") -proc core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime( +proc core::slice::index::slice_index_fail::do_panic::runtime( i32, i32, i32 @@ -2475,7 +2508,10 @@ proc core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runt end @callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 +proc ::max( + i32, + i32 +) -> i32 push.0 dup.2 dup.2 diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index f41eb2940..731dfffb5 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -12,36 +12,36 @@ (export (;8;) "note-idx" (type (eq 7))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (alias export 0 "asset" (type (;1;))) - (alias export 0 "note-idx" (type (;2;))) - (type (;3;) + (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))) + (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;))) + (type $ty-miden:basic-wallet/basic-wallet@0.1.0 (;3;) (instance - (alias outer 1 1 (type (;0;))) + (alias outer 1 $asset (type (;0;))) (export (;1;) "asset" (type (eq 0))) - (alias outer 1 2 (type (;2;))) + (alias outer 1 $note-idx (type (;2;))) (export (;3;) "note-idx" (type (eq 2))) (type (;4;) (func (param "asset" 1) (param "note-idx" 3))) (export (;0;) "move-asset-to-note" (func (type 4))) ) ) - (import "miden:basic-wallet/basic-wallet@0.1.0" (instance (;1;) (type 3))) - (core module (;0;) + (import "miden:basic-wallet/basic-wallet@0.1.0" (instance $miden:basic-wallet/basic-wallet@0.1.0 (;1;) (type $ty-miden:basic-wallet/basic-wallet@0.1.0))) + (core module $main (;0;) (type (;0;) (func (param f32 f32 f32 f32 f32))) (type (;1;) (func)) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32 i32 i32 i32))) - (type (;4;) (func (param i32 i32) (result i32))) - (type (;5;) (func (param i32 i32 i32))) - (type (;6;) (func (param f32 f32 f32 f32))) - (type (;7;) (func (param i32 i32 i32) (result i32))) - (type (;8;) (func (result i32))) - (type (;9;) (func (param f32 f32 f32 f32 i32) (result f32))) - (type (;10;) (func (param i64) (result f32))) - (type (;11;) (func (param i32) (result f32))) - (type (;12;) (func (param f32) (result i64))) - (type (;13;) (func (param f32 f32))) - (type (;14;) (func (param f32 f32 f32 f32) (result f32))) + (type (;2;) (func (param i32 i32) (result i32))) + (type (;3;) (func (param i32 i32 i32))) + (type (;4;) (func (param i32 i32 i32 i32))) + (type (;5;) (func (param f32 f32 f32 f32))) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (result i32))) + (type (;8;) (func (param f32 f32 f32 f32 i32) (result f32))) + (type (;9;) (func (param i32 i32))) + (type (;10;) (func (param f32 f32 f32 f32) (result f32))) + (type (;11;) (func (param f32) (result i64))) + (type (;12;) (func (param f32 f32))) + (type (;13;) (func (param i32) (result f32))) + (type (;14;) (func (param i64) (result f32))) (type (;15;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) (type (;16;) (func (param i32 i32 i32 i32 i32))) (type (;17;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) @@ -54,16 +54,73 @@ (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;1;) (type 1)) - (func $core::slice::index::slice_end_index_len_fail (;2;) (type 2) (param i32 i32) + (func $__rustc::__rust_alloc (;2;) (type 2) (param i32 i32) (result i32) + global.get $GOT.data.internal.__memory_base + i32.const 1048616 + i32.add + local.get 1 local.get 0 + call $::alloc + ) + (func $__rustc::__rust_dealloc (;3;) (type 3) (param i32 i32 i32)) + (func $__rustc::__rust_alloc_zeroed (;4;) (type 2) (param i32 i32) (result i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048616 + 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 $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports (;5;) (type 1)) + (func $core::slice::index::slice_index_fail (;6;) (type 3) (param i32 i32 i32) + block ;; label = @1 + block ;; label = @2 + local.get 0 + local.get 2 + i32.gt_u + br_if 0 (;@2;) + local.get 1 + local.get 2 + i32.gt_u + br_if 1 (;@1;) + local.get 1 + local.get 2 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + call $core::slice::index::slice_index_fail::do_panic::runtime + unreachable + end + local.get 0 + local.get 2 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + call $core::slice::index::slice_index_fail::do_panic::runtime + unreachable + end + local.get 1 + local.get 2 global.get $GOT.data.internal.__memory_base i32.const 1048600 i32.add - call $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime + call $core::slice::index::slice_index_fail::do_panic::runtime unreachable ) - (func $ as core::ops::index::Index>::index (;3;) (type 3) (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 @@ -72,9 +129,10 @@ local.tee 4 i32.le_u br_if 0 (;@1;) + local.get 2 local.get 3 local.get 4 - call $core::slice::index::slice_end_index_len_fail + call $core::slice::index::slice_index_fail unreachable end local.get 0 @@ -91,38 +149,7 @@ i32.add i32.store ) - (func $__rustc::__rust_alloc (;4;) (type 4) (param i32 i32) (result i32) - global.get $GOT.data.internal.__memory_base - i32.const 1048616 - i32.add - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_dealloc (;5;) (type 5) (param i32 i32 i32)) - (func $__rustc::__rust_alloc_zeroed (;6;) (type 4) (param i32 i32) (result i32) - block ;; label = @1 - global.get $GOT.data.internal.__memory_base - i32.const 1048616 - 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 $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports (;7;) (type 1)) - (func $miden:base/transaction-script@1.0.0#run (;8;) (type 6) (param f32 f32 f32 f32) + (func $miden:base/transaction-script@1.0.0#run (;8;) (type 5) (param f32 f32 f32 f32) (local i32 i64 f32 i32 i32 i32) global.get $__stack_pointer i32.const 80 @@ -160,7 +187,7 @@ i32.const 0 i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::try_allocate_in + call $::try_allocate_in local.get 4 i32.load offset=68 local.set 8 @@ -215,29 +242,27 @@ i32.add i32.const 4 i32.const 8 - call $ as core::ops::index::Index>::index + call $ as core::ops::index::Index>>::index local.get 4 i32.load offset=12 i32.const 4 i32.ne br_if 1 (;@1;) local.get 4 - i32.load offset=8 - local.tee 9 - i64.load align=4 - local.set 5 - local.get 4 i32.const 32 i32.add i32.const 8 i32.add - local.get 9 + local.get 4 + i32.load offset=8 + local.tee 9 i32.const 8 i32.add i64.load align=4 i64.store local.get 4 - local.get 5 + local.get 9 + i64.load align=4 i64.store offset=32 local.get 4 i32.const 64 @@ -261,29 +286,27 @@ i32.add i32.const 8 i32.const 12 - call $ as core::ops::index::Index>::index + call $ as core::ops::index::Index>>::index local.get 4 i32.load offset=4 i32.const 4 i32.ne br_if 1 (;@1;) local.get 4 - i32.load - local.tee 9 - i64.load align=4 - local.set 5 - local.get 4 i32.const 48 i32.add i32.const 8 i32.add - local.get 9 + local.get 4 + i32.load + local.tee 9 i32.const 8 i32.add i64.load align=4 i64.store local.get 4 - local.get 5 + local.get 9 + i64.load align=4 i64.store offset=48 local.get 4 i32.const 64 @@ -307,21 +330,16 @@ i32.add i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 4 i32.const 80 i32.add global.set $__stack_pointer return end - global.get $GOT.data.internal.__memory_base - local.set 9 local.get 8 local.get 4 i32.load offset=72 - local.get 9 - i32.const 1048600 - i32.add call $alloc::raw_vec::handle_error end unreachable @@ -347,7 +365,7 @@ i32.store8 end ) - (func $::alloc (;11;) (type 7) (param i32 i32 i32) (result i32) + (func $::alloc (;11;) (type 6) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -366,7 +384,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -419,10 +437,10 @@ end unreachable ) - (func $intrinsics::mem::heap_base (;12;) (type 8) (result i32) + (func $intrinsics::mem::heap_base (;12;) (type 7) (result i32) unreachable ) - (func $miden_base_sys::bindings::output_note::create (;13;) (type 9) (param f32 f32 f32 f32 i32) (result f32) + (func $miden_base_sys::bindings::output_note::create (;13;) (type 8) (param f32 f32 f32 f32 i32) (result f32) local.get 0 local.get 1 local.get 2 @@ -437,7 +455,7 @@ f32.load call $miden::output_note::create ) - (func $>::from (;14;) (type 2) (param i32 i32) + (func $>::from (;14;) (type 9) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -447,25 +465,52 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u64_unchecked (;15;) (type 10) (param i64) (result f32) + (func $intrinsics::advice::adv_push_mapvaln (;15;) (type 10) (param f32 f32 f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;16;) (type 11) (param i32) (result f32) + (func $intrinsics::felt::as_u64 (;16;) (type 11) (param f32) (result i64) unreachable ) - (func $intrinsics::felt::as_u64 (;17;) (type 12) (param f32) (result i64) + (func $intrinsics::felt::assert_eq (;17;) (type 12) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;18;) (type 13) (param f32 f32) + (func $intrinsics::felt::from_u32 (;18;) (type 13) (param i32) (result f32) unreachable ) - (func $intrinsics::advice::adv_push_mapvaln (;19;) (type 14) (param f32 f32 f32 f32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;19;) (type 14) (param i64) (result f32) unreachable ) (func $std::mem::pipe_preimage_to_memory (;20;) (type 15) (param f32 i32 f32 f32 f32 f32) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;21;) (type 5) (param i32 i32 i32) + (func $::alloc_impl (;21;) (type 4) (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 (;22;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -478,7 +523,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -497,7 +542,82 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;22;) (type 16) (param i32 i32 i32 i32 i32) + (func $::current_memory (;23;) (type 4) (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 (;24;) (type 3) (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 (;25;) (type 3) (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 (;26;) (type 16) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -573,32 +693,31 @@ local.get 3 local.get 4 i32.const 1 - call $alloc::alloc::Global::alloc_impl + call $::alloc_impl local.get 5 i32.load local.set 2 end block ;; label = @2 local.get 2 - i32.eqz br_if 0 (;@2;) local.get 0 - local.get 2 + local.get 4 i32.store offset=8 local.get 0 - local.get 1 + local.get 3 i32.store offset=4 - i32.const 0 + i32.const 1 local.set 3 br 1 (;@1;) end local.get 0 - local.get 4 + local.get 2 i32.store offset=8 local.get 0 - local.get 3 + local.get 1 i32.store offset=4 - i32.const 1 + i32.const 0 local.set 3 end local.get 0 @@ -609,115 +728,13 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;23;) (type 5) (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::alloc::Global::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 $alloc::alloc::Global::alloc_impl (;24;) (type 3) (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 $alloc::raw_vec::RawVecInner::current_memory (;25;) (type 3) (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 (;26;) (type 5) (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 $alloc::raw_vec::handle_error (;27;) (type 5) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;27;) (type 9) (param i32 i32) unreachable ) - (func $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime (;28;) (type 5) (param i32 i32 i32) + (func $core::slice::index::slice_index_fail::do_panic::runtime (;28;) (type 3) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;29;) (type 4) (param i32 i32) (result i32) + (func $::max (;29;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -731,23 +748,23 @@ (data $.rodata (;0;) (i32.const 1048576) "\00") (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) - (alias export 0 "word" (type (;4;))) - (alias export 1 "move-asset-to-note" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (core instance (;0;) - (export "move-asset-to-note" (func 0)) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:basic-wallet/basic-wallet@0.1.0 "move-asset-to-note" (func $move-asset-to-note (;0;))) + (core func $move-asset-to-note (;0;) (canon lower (func $move-asset-to-note))) + (core instance $miden:basic-wallet/basic-wallet@0.1.0 (;0;) + (export "move-asset-to-note" (func $move-asset-to-note)) ) - (core instance (;1;) (instantiate 0 - (with "miden:basic-wallet/basic-wallet@0.1.0" (instance 0)) + (core instance $main (;1;) (instantiate $main + (with "miden:basic-wallet/basic-wallet@0.1.0" (instance $miden:basic-wallet/basic-wallet@0.1.0)) ) ) - (alias core export 1 "memory" (core memory (;0;))) - (type (;5;) (func (param "arg" 4))) - (alias core export 1 "miden:base/transaction-script@1.0.0#run" (core func (;1;))) - (func (;1;) (type 5) (canon lift (core func 1))) - (alias export 0 "felt" (type (;6;))) - (alias export 0 "word" (type (;7;))) - (component (;0;) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;5;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;1;))) + (func $run (;1;) (type 5) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;6;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type7 word" (@name "word") (;7;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -760,12 +777,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;2;) (instantiate 0 - (with "import-func-run" (func 1)) - (with "import-type-felt" (type 6)) - (with "import-type-word" (type 7)) - (with "import-type-word0" (type 4)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type7 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;3;) "miden:base/transaction-script@1.0.0" (instance 2)) + (export $miden:base/transaction-script@1.0.0 (;3;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/examples/counter.hir b/tests/integration/expected/examples/counter.hir index 62654e8b1..cc8d3632f 100644 --- a/tests/integration/expected/examples/counter.hir +++ b/tests/integration/expected/examples/counter.hir @@ -5,8 +5,13 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { builtin.ret ; }; + private builtin.function @counter_contract::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + private builtin.function @miden_base_sys::bindings::storage::get_map_item(v0: i32, v1: i32) { - ^block7(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; @@ -80,7 +85,7 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v0, v63) + 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 @@ -89,11 +94,6 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { builtin.ret ; }; - private builtin.function @counter_contract::bindings::__link_custom_section_describing_imports() { - ^block9: - 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 @@ -167,7 +167,7 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { 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 128 : 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; @@ -333,13 +333,13 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v260, v262) + 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 32 : i32; + 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v264, v266) - v508 = arith.constant 128 : i32; + 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; @@ -381,104 +381,96 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { builtin.ret ; }; - private builtin.function @>::from(v294: i32) -> felt { - ^block19(v294: i32): - v296 = arith.constant 255 : i32; - v297 = arith.band v294, v296 : i32; - v298 = hir.bitcast v297 : felt; - builtin.ret v298; - }; - - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v299: i32, v300: i32) { - ^block21(v299: i32, v300: i32): - v303 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v304 = hir.bitcast v303 : ptr; - v305 = hir.load v304 : i32; - v306 = arith.constant 16 : i32; - v307 = arith.sub v305, v306 : i32 #[overflow = wrapping]; - v309 = arith.constant 8 : u32; - v308 = hir.bitcast v300 : u32; - v310 = arith.add v308, v309 : u32 #[overflow = checked]; + 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; - v312 = arith.mod v310, v621 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - v314 = hir.load v313 : i64; + 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; - v315 = hir.bitcast v307 : u32; - v317 = arith.add v315, v620 : u32 #[overflow = checked]; - v318 = arith.constant 4 : u32; - v319 = arith.mod v317, v318 : u32; - hir.assertz v319 #[code = 250]; - v320 = hir.int_to_ptr v317 : ptr; - hir.store v320, v314; - v321 = hir.bitcast v300 : 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; - v323 = arith.mod v321, v619 : 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; - v325 = hir.load v324 : i64; - v326 = hir.bitcast v307 : u32; - v618 = arith.constant 4 : u32; - v328 = arith.mod v326, v618 : u32; - hir.assertz v328 #[code = 250]; - v329 = hir.int_to_ptr v326 : ptr; - hir.store v329, v325; - v330 = arith.constant 12 : i32; - v331 = arith.add v307, v330 : i32 #[overflow = wrapping]; - v301 = arith.constant 0 : i32; - v589, v590, v591, v592, v593, v594 = scf.while v301, v307, v331, v299 : i32, i32, i32, i32, i32, i32 { + 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; - v334 = arith.constant 8 : i32; - v335 = arith.eq v595, v334 : i1; - v336 = arith.zext v335 : u32; - v337 = hir.bitcast v336 : i32; - v339 = arith.neq v337, v617 : i1; - v583, v584 = scf.if v339 : i32, 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 { - ^block26: - v341 = arith.add v596, v595 : i32 #[overflow = wrapping]; - v342 = hir.bitcast v341 : u32; + ^block24: + v336 = arith.add v596, v595 : i32 #[overflow = wrapping]; + v337 = hir.bitcast v336 : u32; v616 = arith.constant 4 : u32; - v344 = arith.mod v342, v616 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - v346 = hir.load v345 : felt; - v348 = hir.bitcast v597 : 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; - v350 = arith.mod v348, v615 : 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; - v352 = hir.load v351 : i32; - v353 = hir.bitcast v341 : u32; - v614 = arith.constant 4 : u32; - v355 = arith.mod v353, v614 : u32; - hir.assertz v355 #[code = 250]; - v356 = hir.int_to_ptr v353 : ptr; - hir.store v356, v352; - v357 = hir.bitcast v597 : u32; + hir.store v351, v347; + v352 = hir.bitcast v597 : u32; v613 = arith.constant 4 : u32; - v359 = arith.mod v357, v613 : u32; - hir.assertz v359 #[code = 250]; - v360 = hir.int_to_ptr v357 : ptr; - hir.store v360, v346; - v363 = arith.constant -4 : i32; - v364 = arith.add v597, v363 : i32 #[overflow = wrapping]; - v361 = arith.constant 4 : i32; - v362 = arith.add v595, v361 : i32 #[overflow = wrapping]; - scf.yield v362, v364; + 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 v339, v611, v598 : i32; + v586 = cf.select v334, v611, v598 : i32; v612 = ub.poison i32 : i32; - v585 = cf.select v339, v612, v596 : i32; + v585 = cf.select v334, v612, v596 : i32; v542 = arith.constant 1 : u32; v535 = arith.constant 0 : u32; - v588 = cf.select v339, v535, v542 : u32; + v588 = cf.select v334, v535, v542 : u32; v576 = arith.trunc v588 : i1; scf.condition v576, v583, v585, v584, v586, v596, v598; } do { @@ -486,36 +478,44 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { scf.yield v599, v600, v601, v602; }; v610 = arith.constant 8 : u32; - v366 = hir.bitcast v593 : u32; - v368 = arith.add v366, v610 : u32 #[overflow = checked]; + v361 = hir.bitcast v593 : u32; + v363 = arith.add v361, v610 : u32 #[overflow = checked]; v609 = arith.constant 4 : u32; - v370 = arith.mod v368, v609 : u32; - hir.assertz v370 #[code = 250]; - v371 = hir.int_to_ptr v368 : ptr; - v372 = hir.load v371 : i64; + 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; - v373 = hir.bitcast v594 : u32; - v375 = arith.add v373, v608 : u32 #[overflow = checked]; + v368 = hir.bitcast v594 : u32; + v370 = arith.add v368, v608 : u32 #[overflow = checked]; v607 = arith.constant 8 : u32; - v377 = arith.mod v375, v607 : u32; - hir.assertz v377 #[code = 250]; - v378 = hir.int_to_ptr v375 : ptr; - hir.store v378, v372; - v379 = hir.bitcast v593 : 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; - v381 = arith.mod v379, v606 : 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; hir.assertz v381 #[code = 250]; v382 = hir.int_to_ptr v379 : ptr; - v383 = hir.load v382 : i64; - v384 = hir.bitcast v594 : u32; - v605 = arith.constant 8 : u32; - v386 = arith.mod v384, v605 : u32; - hir.assertz v386 #[code = 250]; - v387 = hir.int_to_ptr v384 : ptr; - hir.store v387, v383; + hir.store v382, v378; 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; diff --git a/tests/integration/expected/examples/counter.masm b/tests/integration/expected/examples/counter.masm index 7c2f6b0af..8b0b61d71 100644 --- a/tests/integration/expected/examples/counter.masm +++ b/tests/integration/expected/examples/counter.masm @@ -56,6 +56,13 @@ proc __wasm_call_ctors( nop end +@callconv("C") +proc counter_contract::bindings::__link_custom_section_describing_imports( + +) + nop +end + @callconv("C") proc miden_base_sys::bindings::storage::get_map_item( i32, @@ -242,7 +249,7 @@ proc miden_base_sys::bindings::storage::get_map_item( movup.2 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::::reverse trace.252 nop push.32 @@ -257,13 +264,6 @@ proc miden_base_sys::bindings::storage::get_map_item( nop end -@callconv("C") -proc counter_contract::bindings::__link_custom_section_describing_imports( - -) - nop -end - @callconv("C") proc miden:counter-contract/counter-contract@0.1.0#get-count( @@ -434,7 +434,7 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( exec.::intrinsics::mem::load_sw trace.252 nop - push.128 + push.144 u32wrapping_sub push.1114144 dup.1 @@ -845,21 +845,21 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( u32wrapping_add trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::::reverse trace.252 nop push.112 dup.2 u32wrapping_add - push.32 + push.128 dup.3 u32wrapping_add trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::::reverse trace.252 nop - push.128 + push.144 movup.2 u32wrapping_add push.1114144 @@ -947,15 +947,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -1231,6 +1223,14 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( nop end +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + @callconv("C") proc >::from( i32, diff --git a/tests/integration/expected/examples/counter.wat b/tests/integration/expected/examples/counter.wat index 42e87f780..280135a48 100644 --- a/tests/integration/expected/examples/counter.wat +++ b/tests/integration/expected/examples/counter.wat @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 (param i32 i32))) (type (;2;) (func (result f32))) @@ -24,7 +24,8 @@ (export "miden:counter-contract/counter-contract@0.1.0#increment-count" (func $miden:counter-contract/counter-contract@0.1.0#increment-count)) (elem (;0;) (i32.const 1) func $counter_contract::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) - (func $miden_base_sys::bindings::storage::get_map_item (;1;) (type 1) (param i32 i32) + (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) (local i32) global.get $__stack_pointer i32.const 32 @@ -55,13 +56,12 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $counter_contract::bindings::__link_custom_section_describing_imports (;2;) (type 0)) (func $miden:counter-contract/counter-contract@0.1.0#get-count (;3;) (type 2) (result f32) (local i32 f32 f32 f32) global.get $__stack_pointer @@ -109,7 +109,7 @@ (func $miden:counter-contract/counter-contract@0.1.0#increment-count (;4;) (type 2) (result f32) (local i32 f32 f32 f32 f32 f32) global.get $__stack_pointer - i32.const 128 + i32.const 144 i32.sub local.tee 0 global.set $__stack_pointer @@ -194,16 +194,16 @@ local.get 0 i32.const 96 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 0 - i32.const 32 + i32.const 128 i32.add local.get 0 i32.const 112 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 0 - i32.const 128 + i32.const 144 i32.add global.set $__stack_pointer local.get 5 @@ -226,13 +226,7 @@ i32.store8 end ) - (func $>::from (;6;) (type 3) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;7;) (type 1) (param i32 i32) + (func $::reverse (;6;) (type 1) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -290,6 +284,12 @@ 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) (local f32 f32 f32) i32.const 0 @@ -329,16 +329,16 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:counter-contract/counter-contract@0.1.0#get-count" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias core export 0 "miden:counter-contract/counter-contract@0.1.0#increment-count" (core func (;1;))) - (func (;1;) (type 2) (canon lift (core func 1))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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:counter-contract/counter-contract@0.1.0#get-count" (core func $miden:counter-contract/counter-contract@0.1.0#get-count (;0;))) + (func $get-count (;0;) (type 2) (canon lift (core func $miden:counter-contract/counter-contract@0.1.0#get-count))) + (alias core export $main "miden:counter-contract/counter-contract@0.1.0#increment-count" (core func $miden:counter-contract/counter-contract@0.1.0#increment-count (;1;))) + (func $increment-count (;1;) (type 2) (canon lift (core func $miden:counter-contract/counter-contract@0.1.0#increment-count))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type3 felt" (@name "felt") (;3;))) + (component $miden:counter-contract/counter-contract@0.1.0-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))) @@ -350,12 +350,12 @@ (export (;2;) "get-count" (func 0) (func (type 5))) (export (;3;) "increment-count" (func 1) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-get-count" (func 0)) - (with "import-func-increment-count" (func 1)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:counter-contract/counter-contract@0.1.0-shim-instance (;1;) (instantiate $miden:counter-contract/counter-contract@0.1.0-shim-component + (with "import-func-get-count" (func $get-count)) + (with "import-func-increment-count" (func $increment-count)) + (with "import-type-felt" (type $"#type3 felt")) + (with "import-type-felt0" (type $felt)) ) ) - (export (;2;) "miden:counter-contract/counter-contract@0.1.0" (instance 1)) + (export $miden:counter-contract/counter-contract@0.1.0 (;2;) "miden:counter-contract/counter-contract@0.1.0" (instance $miden:counter-contract/counter-contract@0.1.0-shim-instance)) ) diff --git a/tests/integration/expected/examples/counter_note.hir b/tests/integration/expected/examples/counter_note.hir index 182af4e06..6ff9b1d3d 100644 --- a/tests/integration/expected/examples/counter_note.hir +++ b/tests/integration/expected/examples/counter_note.hir @@ -75,16 +75,16 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v38; }; - private builtin.function @intrinsics::felt::from_u32(v40: i32) -> felt { - ^block22(v40: i32): - v41 = hir.bitcast v40 : felt; - builtin.ret v41; + 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::assert_eq(v43: felt, v44: felt) { - ^block24(v43: felt, v44: felt): - hir.assert_eq v43, v44; - 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 { diff --git a/tests/integration/expected/examples/counter_note.masm b/tests/integration/expected/examples/counter_note.masm index 53b4fbc89..6d65b143c 100644 --- a/tests/integration/expected/examples/counter_note.masm +++ b/tests/integration/expected/examples/counter_note.masm @@ -196,12 +196,12 @@ proc intrinsics::felt::add(felt, felt) -> felt end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end diff --git a/tests/integration/expected/examples/counter_note.wat b/tests/integration/expected/examples/counter_note.wat index 547f3fada..42fbcbb73 100644 --- a/tests/integration/expected/examples/counter_note.wat +++ b/tests/integration/expected/examples/counter_note.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,25 +8,25 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (alias export 0 "felt" (type (;1;))) - (type (;2;) + (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))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) + (type $ty-miden:counter-contract/counter-contract@0.1.0 (;2;) (instance - (alias outer 1 1 (type (;0;))) + (alias outer 1 $felt (type (;0;))) (export (;1;) "felt" (type (eq 0))) (type (;2;) (func (result 1))) (export (;0;) "get-count" (func (type 2))) (export (;1;) "increment-count" (func (type 2))) ) ) - (import "miden:counter-contract/counter-contract@0.1.0" (instance (;1;) (type 2))) - (core module (;0;) + (import "miden:counter-contract/counter-contract@0.1.0" (instance $miden:counter-contract/counter-contract@0.1.0 (;1;) (type $ty-miden:counter-contract/counter-contract@0.1.0))) + (core module $main (;0;) (type (;0;) (func (result f32))) (type (;1;) (func)) (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param f32 f32) (result f32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32))) + (type (;4;) (func (param f32 f32))) + (type (;5;) (func (param i32) (result f32))) (import "miden:counter-contract/counter-contract@0.1.0" "get-count" (func $counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 (;0;) (type 0))) (import "miden:counter-contract/counter-contract@0.1.0" "increment-count" (func $counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0 (;1;) (type 0))) (table (;0;) 2 2 funcref) @@ -75,34 +75,34 @@ (func $intrinsics::felt::add (;6;) (type 3) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;7;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::assert_eq (;7;) (type 4) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;8;) (type 5) (param f32 f32) + (func $intrinsics::felt::from_u32 (;8;) (type 5) (param i32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;3;))) - (alias export 1 "get-count" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 1 "increment-count" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (core instance (;0;) - (export "get-count" (func 0)) - (export "increment-count" (func 1)) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;3;))) + (alias export $miden:counter-contract/counter-contract@0.1.0 "get-count" (func $get-count (;0;))) + (core func $get-count (;0;) (canon lower (func $get-count))) + (alias export $miden:counter-contract/counter-contract@0.1.0 "increment-count" (func $increment-count (;1;))) + (core func $increment-count (;1;) (canon lower (func $increment-count))) + (core instance $miden:counter-contract/counter-contract@0.1.0 (;0;) + (export "get-count" (func $get-count)) + (export "increment-count" (func $increment-count)) ) - (core instance (;1;) (instantiate 0 - (with "miden:counter-contract/counter-contract@0.1.0" (instance 0)) + (core instance $main (;1;) (instantiate $main + (with "miden:counter-contract/counter-contract@0.1.0" (instance $miden:counter-contract/counter-contract@0.1.0)) ) ) - (alias core export 1 "memory" (core memory (;0;))) - (type (;4;) (func (param "arg" 3))) - (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;2;))) - (func (;2;) (type 4) (canon lift (core func 2))) - (alias export 0 "felt" (type (;5;))) - (alias export 0 "word" (type (;6;))) - (component (;0;) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;4;) (func (param "arg" $word))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;2;))) + (func $run (;2;) (type 4) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type5 felt" (@name "felt") (;5;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type6 word" (@name "word") (;6;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -115,12 +115,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;2;) (instantiate 0 - (with "import-func-run" (func 2)) - (with "import-type-felt" (type 5)) - (with "import-type-word" (type 6)) - (with "import-type-word0" (type 3)) + (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $"#type5 felt")) + (with "import-type-word" (type $"#type6 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) + (export $miden:base/note-script@1.0.0 (;3;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index bda1e9f8d..d3e535085 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -16,7 +16,7 @@ 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 1048616 : 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; @@ -32,36 +32,36 @@ builtin.component miden:base/note-script@1.0.0 { 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 1048616 : 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 - v898 = arith.constant 0 : i32; + v888 = 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, v898 : i1; + v30 = arith.neq v28, v888 : i1; scf.if v30{ ^block16: scf.yield ; } else { ^block17: - v896 = arith.constant 0 : i32; - v897 = arith.constant 0 : i32; - v32 = arith.eq v16, v897 : i1; + v886 = arith.constant 0 : i32; + v887 = arith.constant 0 : i32; + v32 = arith.eq v16, v887 : i1; v33 = arith.zext v32 : u32; v34 = hir.bitcast v33 : i32; - v36 = arith.neq v34, v896 : i1; + v36 = arith.neq v34, v886 : i1; scf.if v36{ ^block114: scf.yield ; } else { ^block18: - v890 = arith.constant 0 : u8; + v880 = 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, v890; + hir.mem_set v41, v39, v880; scf.yield ; }; scf.yield ; @@ -97,38 +97,38 @@ builtin.component miden:base/note-script@1.0.0 { v64 = hir.int_to_ptr v61 : ptr; v65 = hir.load v64 : i32; v66 = hir.cast v65 : u32; - v956 = scf.index_switch v66 : u32 + v946 = scf.index_switch v66 : u32 case 0 { ^block119: - v1000 = arith.constant 1 : u32; - scf.yield v1000; + v990 = arith.constant 1 : u32; + scf.yield v990; } case 1 { ^block120: - v999 = arith.constant 1 : u32; - scf.yield v999; + v989 = arith.constant 1 : u32; + scf.yield v989; } default { ^block24: v68 = arith.constant 20 : u32; v67 = hir.bitcast v54 : u32; v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v1033 = arith.constant 4 : u32; - v71 = arith.mod v69, v1033 : u32; + v1023 = arith.constant 4 : u32; + v71 = arith.mod v69, v1023 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : i32; - v1032 = arith.constant 4 : u32; + v1022 = arith.constant 4 : u32; v74 = hir.bitcast v73 : u32; - v76 = arith.add v74, v1032 : u32 #[overflow = checked]; - v1031 = arith.constant 4 : u32; - v78 = arith.mod v76, v1031 : u32; + v76 = arith.add v74, v1022 : u32 #[overflow = checked]; + v1021 = arith.constant 4 : u32; + v78 = arith.mod v76, v1021 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; v80 = hir.load v79 : felt; v81 = hir.bitcast v73 : u32; - v1030 = arith.constant 4 : u32; - v83 = arith.mod v81, v1030 : u32; + v1020 = arith.constant 4 : u32; + v83 = arith.mod v81, v1020 : u32; hir.assertz v83 #[code = 250]; v84 = hir.int_to_ptr v81 : ptr; v85 = hir.load v84 : felt; @@ -138,16 +138,16 @@ builtin.component miden:base/note-script@1.0.0 { v89 = arith.constant 12 : u32; v88 = hir.bitcast v54 : u32; v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v1029 = arith.constant 4 : u32; - v92 = arith.mod v90, v1029 : u32; + v1019 = arith.constant 4 : u32; + v92 = arith.mod v90, v1019 : 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]; - v1028 = arith.constant 4 : u32; - v99 = arith.mod v97, v1028 : u32; + v1018 = arith.constant 4 : u32; + v99 = arith.mod v97, v1018 : u32; hir.assertz v99 #[code = 250]; v100 = hir.int_to_ptr v97 : ptr; v101 = hir.load v100 : felt; @@ -158,19 +158,19 @@ builtin.component miden:base/note-script@1.0.0 { v105 = arith.zext v104 : u32; v106 = hir.bitcast v105 : i32; v108 = arith.neq v106, v47 : i1; - v958 = scf.if v108 : u32 { + v948 = scf.if v108 : u32 { ^block118: - v908 = arith.constant 1 : u32; - scf.yield v908; + v898 = arith.constant 1 : u32; + scf.yield v898; } else { ^block25: v109 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v94, v80) : i32 - v1026 = arith.constant 0 : i32; - v1027 = arith.constant 1 : i32; - v111 = arith.neq v109, v1027 : i1; + v1016 = arith.constant 0 : i32; + v1017 = arith.constant 1 : i32; + v111 = arith.neq v109, v1017 : i1; v112 = arith.zext v111 : u32; v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v1026 : i1; + v115 = arith.neq v113, v1016 : i1; scf.if v115{ ^block117: scf.yield ; @@ -182,136 +182,136 @@ builtin.component miden:base/note-script@1.0.0 { v119 = arith.constant 36 : u32; v118 = hir.bitcast v54 : u32; v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v1025 = arith.constant 4 : u32; - v122 = arith.mod v120, v1025 : u32; + v1015 = arith.constant 4 : u32; + v122 = arith.mod v120, v1015 : 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]; - v1024 = arith.constant 4 : u32; - v132 = arith.mod v130, v1024 : u32; + v1014 = arith.constant 4 : u32; + v132 = arith.mod v130, v1014 : 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]; - v1023 = arith.constant 4 : u32; - v139 = arith.mod v137, v1023 : u32; + v1013 = arith.constant 4 : u32; + v139 = arith.mod v137, v1013 : u32; hir.assertz v139 #[code = 250]; v140 = hir.int_to_ptr v137 : ptr; v141 = hir.load v140 : i32; - v1022 = arith.constant 4 : u32; - v127 = arith.shl v124, v1022 : i32; - v976, v977, v978, v979, v980, v981, v982, v983 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block132(v984: i32, v985: i32, v986: i32, v987: i32, v988: i32): - v1020 = arith.constant 0 : i32; - v1021 = arith.constant 0 : i32; - v144 = arith.eq v984, v1021 : i1; + v1012 = arith.constant 4 : u32; + v127 = arith.shl v124, v1012 : i32; + v966, v967, v968, v969, v970, v971, v972, v973 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { + ^block132(v974: i32, v975: i32, v976: i32, v977: i32, v978: i32): + v1010 = arith.constant 0 : i32; + v1011 = arith.constant 0 : i32; + v144 = arith.eq v974, v1011 : i1; v145 = arith.zext v144 : u32; v146 = hir.bitcast v145 : i32; - v148 = arith.neq v146, v1020 : i1; - v969, v970 = scf.if v148 : i32, i32 { + v148 = arith.neq v146, v1010 : i1; + v959, v960 = scf.if v148 : i32, i32 { ^block131: - v909 = ub.poison i32 : i32; - scf.yield v909, v909; + v899 = ub.poison i32 : i32; + scf.yield v899, v899; } else { ^block30: - v150 = hir.bitcast v985 : u32; - v1019 = arith.constant 4 : u32; - v152 = arith.mod v150, v1019 : u32; + v150 = hir.bitcast v975 : u32; + v1009 = arith.constant 4 : u32; + v152 = arith.mod v150, v1009 : u32; hir.assertz v152 #[code = 250]; v153 = hir.int_to_ptr v150 : ptr; v154 = hir.load v153 : felt; - v1018 = arith.constant 4 : u32; - v155 = hir.bitcast v985 : u32; - v157 = arith.add v155, v1018 : u32 #[overflow = checked]; - v1017 = arith.constant 4 : u32; - v159 = arith.mod v157, v1017 : u32; + v1008 = arith.constant 4 : u32; + v155 = hir.bitcast v975 : u32; + v157 = arith.add v155, v1008 : u32 #[overflow = checked]; + v1007 = arith.constant 4 : u32; + v159 = arith.mod v157, v1007 : u32; hir.assertz v159 #[code = 250]; v160 = hir.int_to_ptr v157 : ptr; v161 = hir.load v160 : felt; - v1016 = arith.constant 8 : u32; - v162 = hir.bitcast v985 : u32; - v164 = arith.add v162, v1016 : u32 #[overflow = checked]; - v1015 = arith.constant 4 : u32; - v166 = arith.mod v164, v1015 : u32; + v1006 = arith.constant 8 : u32; + v162 = hir.bitcast v975 : u32; + v164 = arith.add v162, v1006 : u32 #[overflow = checked]; + v1005 = arith.constant 4 : u32; + v166 = arith.mod v164, v1005 : u32; hir.assertz v166 #[code = 250]; v167 = hir.int_to_ptr v164 : ptr; v168 = hir.load v167 : felt; - v1014 = arith.constant 12 : u32; - v169 = hir.bitcast v985 : u32; - v171 = arith.add v169, v1014 : u32 #[overflow = checked]; - v1013 = arith.constant 4 : u32; - v173 = arith.mod v171, v1013 : u32; + v1004 = arith.constant 12 : u32; + v169 = hir.bitcast v975 : u32; + v171 = arith.add v169, v1004 : u32 #[overflow = checked]; + v1003 = arith.constant 4 : u32; + v173 = arith.mod v171, v1003 : 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) - v1012 = arith.constant 16 : i32; - v179 = arith.add v985, v1012 : i32 #[overflow = wrapping]; + v1002 = arith.constant 16 : i32; + v179 = arith.add v975, v1002 : i32 #[overflow = wrapping]; v176 = arith.constant -16 : i32; - v177 = arith.add v984, v176 : i32 #[overflow = wrapping]; + v177 = arith.add v974, v176 : i32 #[overflow = wrapping]; scf.yield v177, v179; }; - v1008 = ub.poison i32 : i32; - v973 = cf.select v148, v1008, v988 : i32; - v1009 = ub.poison i32 : i32; - v972 = cf.select v148, v1009, v987 : i32; - v1010 = ub.poison i32 : i32; - v971 = cf.select v148, v1010, v986 : i32; - v1011 = arith.constant 1 : u32; - v900 = arith.constant 0 : u32; - v975 = cf.select v148, v900, v1011 : u32; - v953 = arith.trunc v975 : i1; - scf.condition v953, v969, v970, v971, v972, v973, v986, v987, v988; + v998 = ub.poison i32 : i32; + v963 = cf.select v148, v998, v978 : i32; + v999 = ub.poison i32 : i32; + v962 = cf.select v148, v999, v977 : i32; + v1000 = ub.poison i32 : i32; + v961 = cf.select v148, v1000, v976 : i32; + v1001 = arith.constant 1 : u32; + v890 = arith.constant 0 : u32; + v965 = cf.select v148, v890, v1001 : u32; + v943 = arith.trunc v965 : i1; + scf.condition v943, v959, v960, v961, v962, v963, v976, v977, v978; } do { - ^block133(v989: i32, v990: i32, v991: i32, v992: i32, v993: i32, v994: i32, v995: i32, v996: i32): - scf.yield v989, v990, v991, v992, v993; + ^block133(v979: i32, v980: i32, v981: i32, v982: i32, v983: i32, v984: i32, v985: i32, v986: i32): + scf.yield v979, v980, v981, v982, v983; }; v183 = arith.constant 44 : u32; - v182 = hir.bitcast v981 : u32; + v182 = hir.bitcast v971 : u32; v184 = arith.add v182, v183 : u32 #[overflow = checked]; - v1007 = arith.constant 4 : u32; - v186 = arith.mod v184, v1007 : u32; + v997 = arith.constant 4 : u32; + v186 = arith.mod v184, v997 : u32; hir.assertz v186 #[code = 250]; v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v982; + hir.store v187, v972; v190 = arith.constant 40 : u32; - v189 = hir.bitcast v981 : u32; + v189 = hir.bitcast v971 : u32; v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v1006 = arith.constant 4 : u32; - v193 = arith.mod v191, v1006 : u32; + v996 = arith.constant 4 : u32; + v193 = arith.mod v191, v996 : u32; hir.assertz v193 #[code = 250]; v194 = hir.int_to_ptr v191 : ptr; - hir.store v194, v983; - v1005 = arith.constant 16 : i32; + hir.store v194, v973; + v995 = arith.constant 16 : i32; v195 = arith.constant 40 : i32; - v196 = arith.add v981, v195 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v196, v1005, v1005) + v196 = arith.add v971, v195 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v196, v995, v995) v125 = arith.constant 4 : i32; - v1004 = arith.constant 16 : i32; - v200 = arith.add v981, v1004 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v200, v125, v125) - v1003 = arith.constant 48 : i32; - v204 = arith.add v981, v1003 : i32 #[overflow = wrapping]; + v994 = arith.constant 16 : i32; + v200 = arith.add v971, v994 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v200, v125, v125) + v993 = arith.constant 48 : i32; + v204 = arith.add v971, v993 : 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; scf.yield ; }; - v1001 = arith.constant 0 : u32; - v1002 = arith.constant 1 : u32; - v997 = cf.select v115, v1002, v1001 : u32; - scf.yield v997; + v991 = arith.constant 0 : u32; + v992 = arith.constant 1 : u32; + v987 = cf.select v115, v992, v991 : u32; + scf.yield v987; }; - scf.yield v958; + scf.yield v948; }; - v998 = arith.constant 0 : u32; - v968 = arith.eq v956, v998 : i1; - cf.cond_br v968 ^block122, ^block23; + v988 = arith.constant 0 : u32; + v958 = arith.eq v946, v988 : i1; + cf.cond_br v958 ^block122, ^block23; ^block23: ub.unreachable ; ^block122: @@ -328,7 +328,7 @@ builtin.component miden:base/note-script@1.0.0 { 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 1048620 : 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; @@ -346,12 +346,12 @@ builtin.component miden:base/note-script@1.0.0 { v221 = hir.bitcast v220 : ptr; v222 = hir.load v221 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1035 = arith.constant 1 : u8; - v1037 = arith.constant 1048620 : i32; - v224 = arith.add v222, v1037 : i32 #[overflow = wrapping]; + v1025 = arith.constant 1 : u8; + v1027 = arith.constant 1048592 : i32; + v224 = arith.add v222, v1027 : i32 #[overflow = wrapping]; v228 = hir.bitcast v224 : u32; v229 = hir.int_to_ptr v228 : ptr; - hir.store v229, v1035; + hir.store v229, v1025; scf.yield ; }; builtin.ret ; @@ -361,27 +361,27 @@ builtin.component miden:base/note-script@1.0.0 { ^block37(v230: i32, v231: i32, v232: i32): v235 = arith.constant 16 : i32; v234 = arith.constant 0 : i32; - v1039 = arith.constant 16 : u32; + v1029 = arith.constant 16 : u32; v237 = hir.bitcast v231 : u32; - v239 = arith.gt v237, v1039 : i1; + v239 = arith.gt v237, v1029 : i1; v240 = arith.zext v239 : u32; v241 = hir.bitcast v240 : i32; v243 = arith.neq v241, v234 : i1; v244 = cf.select v243, v231, v235 : i32; - v1079 = arith.constant 0 : i32; + v1069 = 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, v1079 : i1; - v1048, v1049 = scf.if v249 : i32, u32 { + v249 = arith.neq v247, v1069 : i1; + v1038, v1039 = scf.if v249 : i32, u32 { ^block137: - v1040 = arith.constant 0 : u32; - v1044 = ub.poison i32 : i32; - scf.yield v1044, v1040; + v1030 = arith.constant 0 : u32; + v1034 = ub.poison i32 : i32; + scf.yield v1034, v1030; } else { ^block40: - v251 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v231, v244) : i32 - v1078 = arith.constant 0 : i32; + v251 = hir.exec @miden:base/note-script@1.0.0/p2id/::max(v231, v244) : i32 + v1068 = arith.constant 0 : i32; v250 = arith.constant -2147483648 : i32; v252 = arith.sub v250, v251 : i32 #[overflow = wrapping]; v254 = hir.bitcast v252 : u32; @@ -389,18 +389,18 @@ builtin.component miden:base/note-script@1.0.0 { v255 = arith.gt v253, v254 : i1; v256 = arith.zext v255 : u32; v257 = hir.bitcast v256 : i32; - v259 = arith.neq v257, v1078 : i1; - v1063 = scf.if v259 : i32 { + v259 = arith.neq v257, v1068 : i1; + v1053 = scf.if v259 : i32 { ^block136: - v1077 = ub.poison i32 : i32; - scf.yield v1077; + v1067 = ub.poison i32 : i32; + scf.yield v1067; } else { ^block41: - v1075 = arith.constant 0 : i32; - v265 = arith.sub v1075, v251 : i32 #[overflow = wrapping]; - v1076 = arith.constant -1 : i32; + v1065 = arith.constant 0 : i32; + v265 = arith.sub v1065, v251 : i32 #[overflow = wrapping]; + v1066 = arith.constant -1 : i32; v261 = arith.add v232, v251 : i32 #[overflow = wrapping]; - v263 = arith.add v261, v1076 : i32 #[overflow = wrapping]; + v263 = arith.add v261, v1066 : i32 #[overflow = wrapping]; v266 = arith.band v263, v265 : i32; v267 = hir.bitcast v230 : u32; v268 = arith.constant 4 : u32; @@ -408,8 +408,8 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v269 #[code = 250]; v270 = hir.int_to_ptr v267 : ptr; v271 = hir.load v270 : i32; - v1074 = arith.constant 0 : i32; - v273 = arith.neq v271, v1074 : i1; + v1064 = arith.constant 0 : i32; + v273 = arith.neq v271, v1064 : i1; scf.if v273{ ^block135: scf.yield ; @@ -418,41 +418,41 @@ builtin.component miden:base/note-script@1.0.0 { 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; - v1073 = arith.constant 4 : u32; - v283 = arith.mod v281, v1073 : u32; + v1063 = arith.constant 4 : u32; + v283 = arith.mod v281, v1063 : u32; hir.assertz v283 #[code = 250]; - v1072 = arith.constant 16 : u32; + v1062 = arith.constant 16 : u32; v276 = hir.bitcast v275 : i32; - v279 = arith.shl v276, v1072 : i32; + v279 = arith.shl v276, v1062 : i32; v280 = arith.add v274, v279 : i32 #[overflow = wrapping]; v284 = hir.int_to_ptr v281 : ptr; hir.store v284, v280; scf.yield ; }; v287 = hir.bitcast v230 : u32; - v1071 = arith.constant 4 : u32; - v289 = arith.mod v287, v1071 : u32; + v1061 = arith.constant 4 : u32; + v289 = arith.mod v287, v1061 : u32; hir.assertz v289 #[code = 250]; v290 = hir.int_to_ptr v287 : ptr; v291 = hir.load v290 : i32; - v1069 = arith.constant 0 : i32; - v1070 = arith.constant -1 : i32; - v293 = arith.bxor v291, v1070 : i32; + v1059 = arith.constant 0 : i32; + v1060 = arith.constant -1 : i32; + v293 = arith.bxor v291, v1060 : 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, v1069 : i1; - v1062 = scf.if v300 : i32 { + v300 = arith.neq v298, v1059 : i1; + v1052 = scf.if v300 : i32 { ^block44: - v1068 = arith.constant 0 : i32; - scf.yield v1068; + v1058 = arith.constant 0 : i32; + scf.yield v1058; } else { ^block45: v302 = hir.bitcast v230 : u32; - v1067 = arith.constant 4 : u32; - v304 = arith.mod v302, v1067 : u32; + v1057 = arith.constant 4 : u32; + v304 = arith.mod v302, v1057 : u32; hir.assertz v304 #[code = 250]; v301 = arith.add v291, v266 : i32 #[overflow = wrapping]; v305 = hir.int_to_ptr v302 : ptr; @@ -460,20 +460,20 @@ builtin.component miden:base/note-script@1.0.0 { v307 = arith.add v291, v251 : i32 #[overflow = wrapping]; scf.yield v307; }; - scf.yield v1062; + scf.yield v1052; }; - v1045 = arith.constant 1 : u32; - v1066 = arith.constant 0 : u32; - v1064 = cf.select v259, v1066, v1045 : u32; - scf.yield v1063, v1064; + v1035 = arith.constant 1 : u32; + v1056 = arith.constant 0 : u32; + v1054 = cf.select v259, v1056, v1035 : u32; + scf.yield v1053, v1054; }; - v1065 = arith.constant 0 : u32; - v1061 = arith.eq v1049, v1065 : i1; - cf.cond_br v1061 ^block39, ^block139(v1048); + v1055 = arith.constant 0 : u32; + v1051 = arith.eq v1039, v1055 : i1; + cf.cond_br v1051 ^block39, ^block139(v1038); ^block39: ub.unreachable ; - ^block139(v1041: i32): - builtin.ret v1041; + ^block139(v1031: i32): + builtin.ret v1031; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -482,7 +482,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v310; }; - private builtin.function @alloc::vec::Vec::with_capacity(v312: i32) { + 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; @@ -492,21 +492,21 @@ builtin.component miden:base/note-script@1.0.0 { v320 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v321 = hir.bitcast v320 : ptr; hir.store v321, v319; - v1084 = arith.constant 16 : i32; + v1074 = 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/alloc::raw_vec::RawVecInner::with_capacity_in(v323, v1084, v1084) + hir.exec @miden:base/note-script@1.0.0/p2id/::with_capacity_in(v323, v1074, v1074) v327 = arith.constant 8 : u32; v326 = hir.bitcast v319 : u32; v328 = arith.add v326, v327 : u32 #[overflow = checked]; - v1083 = arith.constant 8 : u32; - v330 = arith.mod v328, v1083 : u32; + v1073 = arith.constant 8 : u32; + v330 = arith.mod v328, v1073 : u32; hir.assertz v330 #[code = 250]; v331 = hir.int_to_ptr v328 : ptr; v332 = hir.load v331 : i64; - v1082 = arith.constant 8 : u32; + v1072 = arith.constant 8 : u32; v334 = hir.bitcast v312 : u32; - v336 = arith.add v334, v1082 : u32 #[overflow = checked]; + v336 = arith.add v334, v1072 : u32 #[overflow = checked]; v337 = arith.constant 4 : u32; v338 = arith.mod v336, v337 : u32; hir.assertz v338 #[code = 250]; @@ -514,20 +514,20 @@ builtin.component miden:base/note-script@1.0.0 { v339 = hir.int_to_ptr v336 : ptr; hir.store v339, v313; v340 = hir.bitcast v312 : u32; - v1081 = arith.constant 4 : u32; - v342 = arith.mod v340, v1081 : u32; + v1071 = arith.constant 4 : u32; + v342 = arith.mod v340, v1071 : u32; hir.assertz v342 #[code = 250]; v343 = hir.int_to_ptr v340 : ptr; hir.store v343, v332; - v1080 = arith.constant 16 : i32; - v345 = arith.add v319, v1080 : i32 #[overflow = wrapping]; + v1070 = arith.constant 16 : i32; + v345 = arith.add v319, v1070 : 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 ; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v348: i32, v349: i32, v350: i32) { + private builtin.function @::with_capacity_in(v348: i32, v349: i32, v350: i32) { ^block52(v348: i32, v349: i32, v350: i32): v352 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v353 = hir.bitcast v352 : ptr; @@ -541,7 +541,7 @@ builtin.component miden:base/note-script@1.0.0 { 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/alloc::raw_vec::RawVecInner::try_allocate_in(v360, v361, v351, v349, v350) + 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]; @@ -550,724 +550,715 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v367 #[code = 250]; v368 = hir.int_to_ptr v365 : ptr; v369 = hir.load v368 : i32; - v1095 = arith.constant 4 : u32; + v1085 = arith.constant 4 : u32; v370 = hir.bitcast v356 : u32; - v372 = arith.add v370, v1095 : u32 #[overflow = checked]; - v1094 = arith.constant 4 : u32; - v374 = arith.mod v372, v1094 : u32; + v372 = arith.add v370, v1085 : u32 #[overflow = checked]; + v1084 = arith.constant 4 : u32; + v374 = arith.mod v372, v1084 : u32; hir.assertz v374 #[code = 250]; v375 = hir.int_to_ptr v372 : ptr; v376 = hir.load v375 : i32; - v1093 = arith.constant 0 : i32; + v1083 = 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, v1093 : i1; + v382 = arith.neq v380, v1083 : i1; cf.cond_br v382 ^block54, ^block55; ^block54: - v396 = arith.constant 12 : u32; - v395 = hir.bitcast v356 : u32; - v397 = arith.add v395, v396 : u32 #[overflow = checked]; - v1092 = arith.constant 4 : u32; - v399 = arith.mod v397, v1092 : u32; - hir.assertz v399 #[code = 250]; - v400 = hir.int_to_ptr v397 : ptr; - v401 = hir.load v400 : i32; - v1091 = arith.constant 4 : u32; - v402 = hir.bitcast v348 : u32; - v404 = arith.add v402, v1091 : u32 #[overflow = checked]; - v1090 = arith.constant 4 : u32; - v406 = arith.mod v404, v1090 : u32; - hir.assertz v406 #[code = 250]; - v407 = hir.int_to_ptr v404 : ptr; - hir.store v407, v401; - v408 = hir.bitcast v348 : u32; - v1089 = arith.constant 4 : u32; - v410 = arith.mod v408, v1089 : u32; - hir.assertz v410 #[code = 250]; - v411 = hir.int_to_ptr v408 : ptr; - hir.store v411, v369; - v1088 = arith.constant 16 : i32; - v413 = arith.add v356, v1088 : i32 #[overflow = wrapping]; - v414 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v415 = hir.bitcast v414 : ptr; - hir.store v415, v413; + v391 = arith.constant 12 : u32; + v390 = hir.bitcast v356 : u32; + v392 = arith.add v390, v391 : u32 #[overflow = checked]; + v1082 = arith.constant 4 : u32; + v394 = arith.mod v392, v1082 : u32; + hir.assertz v394 #[code = 250]; + v395 = hir.int_to_ptr v392 : ptr; + v396 = hir.load v395 : i32; + v1081 = arith.constant 4 : u32; + v397 = hir.bitcast v348 : u32; + v399 = arith.add v397, v1081 : u32 #[overflow = checked]; + v1080 = arith.constant 4 : u32; + v401 = arith.mod v399, v1080 : u32; + hir.assertz v401 #[code = 250]; + v402 = hir.int_to_ptr v399 : ptr; + hir.store v402, v396; + v403 = hir.bitcast v348 : u32; + v1079 = arith.constant 4 : u32; + v405 = arith.mod v403, v1079 : u32; + hir.assertz v405 #[code = 250]; + v406 = hir.int_to_ptr v403 : ptr; + hir.store v406, v369; + v1078 = arith.constant 16 : i32; + v408 = arith.add v356, v1078 : 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; builtin.ret ; ^block55: - v383 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v384 = hir.bitcast v383 : ptr; - v385 = hir.load v384 : i32; - v1087 = arith.constant 12 : u32; - v386 = hir.bitcast v356 : u32; - v388 = arith.add v386, v1087 : u32 #[overflow = checked]; - v1086 = arith.constant 4 : u32; - v390 = arith.mod v388, v1086 : u32; - hir.assertz v390 #[code = 250]; - v391 = hir.int_to_ptr v388 : ptr; - v392 = hir.load v391 : i32; - v393 = arith.constant 1048600 : i32; - v394 = arith.add v385, v393 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v369, v392, v394) + v1077 = arith.constant 12 : u32; + v383 = hir.bitcast v356 : u32; + v385 = arith.add v383, v1077 : u32 #[overflow = checked]; + v1076 = arith.constant 4 : u32; + v387 = arith.mod v385, v1076 : 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) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_account::get_id(v416: i32) { - ^block56(v416: i32): + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v411: i32) { + ^block56(v411: i32): + v413 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v414 = hir.bitcast v413 : ptr; + v415 = hir.load v414 : i32; + v416 = arith.constant 16 : i32; + v417 = arith.sub v415, v416 : i32 #[overflow = wrapping]; v418 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v419 = hir.bitcast v418 : ptr; - v420 = hir.load v419 : i32; - v421 = arith.constant 16 : i32; - v422 = arith.sub v420, v421 : i32 #[overflow = wrapping]; - v423 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v424 = hir.bitcast v423 : ptr; - hir.store v424, v422; - v425 = arith.constant 8 : i32; - v426 = arith.add v422, v425 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v426) - v428 = arith.constant 8 : u32; - v427 = hir.bitcast v422 : 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 : i64; - v434 = hir.bitcast v416 : u32; - v1097 = arith.constant 8 : u32; - v436 = arith.mod v434, v1097 : u32; - hir.assertz v436 #[code = 250]; - v437 = hir.int_to_ptr v434 : ptr; - hir.store v437, v433; - v1096 = arith.constant 16 : i32; - v439 = arith.add v422, v1096 : i32 #[overflow = wrapping]; - v440 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v441 = hir.bitcast v440 : ptr; - hir.store v441, v439; + hir.store v419, v417; + v420 = arith.constant 4 : i32; + v421 = arith.add v417, v420 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/>::with_capacity(v421) + v425 = arith.constant 8 : u32; + v424 = hir.bitcast v417 : u32; + v426 = arith.add v424, v425 : u32 #[overflow = checked]; + v427 = arith.constant 4 : u32; + v428 = arith.mod v426, v427 : u32; + hir.assertz v428 #[code = 250]; + v429 = hir.int_to_ptr v426 : ptr; + v430 = hir.load v429 : i32; + v1086 = arith.constant 2 : u32; + v432 = hir.bitcast v430 : u32; + v434 = arith.shr v432, v1086 : u32; + v435 = hir.bitcast v434 : i32; + v436 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v435) : i32 + v422 = arith.constant 8 : i32; + v423 = arith.add v411, v422 : i32 #[overflow = wrapping]; + v437 = hir.bitcast v423 : u32; + v1091 = arith.constant 4 : u32; + v439 = arith.mod v437, v1091 : u32; + hir.assertz v439 #[code = 250]; + v440 = hir.int_to_ptr v437 : ptr; + hir.store v440, v436; + v1090 = arith.constant 4 : u32; + v441 = hir.bitcast v417 : u32; + v443 = arith.add v441, v1090 : u32 #[overflow = checked]; + v1089 = arith.constant 4 : u32; + v445 = arith.mod v443, v1089 : u32; + hir.assertz v445 #[code = 250]; + v446 = hir.int_to_ptr v443 : ptr; + v447 = hir.load v446 : i64; + v448 = hir.bitcast v411 : u32; + v1088 = arith.constant 4 : u32; + v450 = arith.mod v448, v1088 : u32; + hir.assertz v450 #[code = 250]; + v451 = hir.int_to_ptr v448 : ptr; + hir.store v451, v447; + v1087 = arith.constant 16 : i32; + v453 = arith.add v417, v1087 : i32 #[overflow = wrapping]; + v454 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v455 = hir.bitcast v454 : ptr; + hir.store v455, v453; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v442: i32) { - ^block58(v442: i32): - v444 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v445 = hir.bitcast v444 : ptr; - v446 = hir.load v445 : i32; - v447 = arith.constant 16 : i32; - v448 = arith.sub v446, v447 : i32 #[overflow = wrapping]; - v449 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v450 = hir.bitcast v449 : ptr; - hir.store v450, v448; - v453 = arith.constant 4 : i32; - v451 = arith.constant 8 : i32; - v452 = arith.add v448, v451 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v452, v453, v453) - v456 = arith.constant 8 : u32; - v455 = hir.bitcast v448 : u32; - v457 = arith.add v455, v456 : u32 #[overflow = checked]; - v458 = arith.constant 4 : u32; - v459 = arith.mod v457, v458 : u32; - hir.assertz v459 #[code = 250]; - v460 = hir.int_to_ptr v457 : ptr; - v461 = hir.load v460 : i32; - v463 = arith.constant 12 : u32; - v462 = hir.bitcast v448 : u32; - v464 = arith.add v462, v463 : u32 #[overflow = checked]; - v1105 = arith.constant 4 : u32; - v466 = arith.mod v464, v1105 : u32; - hir.assertz v466 #[code = 250]; - v467 = hir.int_to_ptr v464 : ptr; - v468 = hir.load v467 : i32; - v1098 = arith.constant 2 : u32; - v470 = hir.bitcast v468 : u32; - v472 = arith.shr v470, v1098 : u32; - v473 = hir.bitcast v472 : i32; - v474 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v473) : i32 - v1104 = arith.constant 8 : u32; - v475 = hir.bitcast v442 : u32; - v477 = arith.add v475, v1104 : u32 #[overflow = checked]; - v1103 = arith.constant 4 : u32; - v479 = arith.mod v477, v1103 : u32; - hir.assertz v479 #[code = 250]; - v480 = hir.int_to_ptr v477 : ptr; - hir.store v480, v474; - v1102 = arith.constant 4 : u32; - v481 = hir.bitcast v442 : u32; - v483 = arith.add v481, v1102 : u32 #[overflow = checked]; - v1101 = arith.constant 4 : u32; - v485 = arith.mod v483, v1101 : u32; - hir.assertz v485 #[code = 250]; - v486 = hir.int_to_ptr v483 : ptr; - hir.store v486, v468; - v487 = hir.bitcast v442 : u32; - v1100 = arith.constant 4 : u32; - v489 = arith.mod v487, v1100 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - hir.store v490, v461; - v1099 = arith.constant 16 : i32; - v492 = arith.add v448, v1099 : i32 #[overflow = wrapping]; - v493 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v494 = hir.bitcast v493 : ptr; - hir.store v494, v492; + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v456: i32) { + ^block58(v456: i32): + v458 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__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:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v464 = hir.bitcast v463 : ptr; + hir.store v464, v462; + v467 = arith.constant 4 : i32; + v465 = arith.constant 8 : i32; + v466 = arith.add v462, v465 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::with_capacity_in(v466, v467, v467) + v470 = arith.constant 8 : u32; + v469 = hir.bitcast v462 : u32; + v471 = arith.add v469, v470 : u32 #[overflow = checked]; + v472 = arith.constant 4 : u32; + v473 = arith.mod v471, v472 : u32; + hir.assertz v473 #[code = 250]; + v474 = hir.int_to_ptr v471 : ptr; + v475 = hir.load v474 : i32; + v477 = arith.constant 12 : u32; + v476 = hir.bitcast v462 : u32; + v478 = arith.add v476, v477 : u32 #[overflow = checked]; + v1099 = arith.constant 4 : u32; + v480 = arith.mod v478, v1099 : u32; + hir.assertz v480 #[code = 250]; + v481 = hir.int_to_ptr v478 : ptr; + v482 = hir.load v481 : i32; + v1092 = arith.constant 2 : u32; + v484 = hir.bitcast v482 : u32; + v486 = arith.shr v484, v1092 : u32; + v487 = hir.bitcast v486 : i32; + v488 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v487) : i32 + v1098 = arith.constant 8 : u32; + v489 = hir.bitcast v456 : u32; + v491 = arith.add v489, v1098 : u32 #[overflow = checked]; + v1097 = arith.constant 4 : u32; + v493 = arith.mod v491, v1097 : u32; + hir.assertz v493 #[code = 250]; + v494 = hir.int_to_ptr v491 : ptr; + hir.store v494, v488; + v1096 = arith.constant 4 : u32; + v495 = hir.bitcast v456 : u32; + v497 = arith.add v495, v1096 : u32 #[overflow = checked]; + v1095 = arith.constant 4 : u32; + v499 = arith.mod v497, v1095 : u32; + hir.assertz v499 #[code = 250]; + v500 = hir.int_to_ptr v497 : ptr; + hir.store v500, v482; + v501 = hir.bitcast v456 : u32; + v1094 = arith.constant 4 : u32; + v503 = arith.mod v501, v1094 : u32; + hir.assertz v503 #[code = 250]; + v504 = hir.int_to_ptr v501 : ptr; + hir.store v504, v475; + v1093 = arith.constant 16 : i32; + v506 = arith.add v462, v1093 : i32 #[overflow = wrapping]; + v507 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v508 = hir.bitcast v507 : ptr; + hir.store v508, v506; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_assets(v495: i32) { - ^block60(v495: i32): - v497 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v498 = hir.bitcast v497 : ptr; - v499 = hir.load v498 : i32; - v500 = arith.constant 16 : i32; - v501 = arith.sub v499, v500 : i32 #[overflow = wrapping]; - v502 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v503 = hir.bitcast v502 : ptr; - hir.store v503, v501; - v504 = arith.constant 4 : i32; - v505 = arith.add v501, v504 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v505) - v509 = arith.constant 8 : u32; - v508 = hir.bitcast v501 : u32; - v510 = arith.add v508, v509 : u32 #[overflow = checked]; - v511 = arith.constant 4 : u32; - v512 = arith.mod v510, v511 : u32; - hir.assertz v512 #[code = 250]; - v513 = hir.int_to_ptr v510 : ptr; - v514 = hir.load v513 : i32; - v1106 = arith.constant 2 : u32; - v516 = hir.bitcast v514 : u32; - v518 = arith.shr v516, v1106 : u32; - v519 = hir.bitcast v518 : i32; - v520 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v519) : i32 - v506 = arith.constant 8 : i32; - v507 = arith.add v495, v506 : i32 #[overflow = wrapping]; - v521 = hir.bitcast v507 : u32; - v1111 = arith.constant 4 : u32; - v523 = arith.mod v521, v1111 : u32; - hir.assertz v523 #[code = 250]; - v524 = hir.int_to_ptr v521 : ptr; - hir.store v524, v520; - v1110 = arith.constant 4 : u32; - v525 = hir.bitcast v501 : u32; - v527 = arith.add v525, v1110 : u32 #[overflow = checked]; - v1109 = arith.constant 4 : u32; - v529 = arith.mod v527, v1109 : u32; + private builtin.function @miden_base_sys::bindings::active_account::get_id(v509: i32) { + ^block60(v509: i32): + v511 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v512 = hir.bitcast v511 : ptr; + v513 = hir.load v512 : i32; + v514 = arith.constant 16 : i32; + v515 = arith.sub v513, v514 : i32 #[overflow = wrapping]; + v516 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v517 = hir.bitcast v516 : ptr; + hir.store v517, v515; + v518 = arith.constant 8 : i32; + v519 = arith.add v515, v518 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v519) + v521 = arith.constant 8 : u32; + v520 = hir.bitcast v515 : u32; + v522 = arith.add v520, v521 : u32 #[overflow = checked]; + v523 = arith.constant 4 : u32; + v524 = arith.mod v522, v523 : u32; + hir.assertz v524 #[code = 250]; + v525 = hir.int_to_ptr v522 : ptr; + v526 = hir.load v525 : i64; + v527 = hir.bitcast v509 : u32; + v1101 = arith.constant 8 : u32; + v529 = arith.mod v527, v1101 : u32; hir.assertz v529 #[code = 250]; v530 = hir.int_to_ptr v527 : ptr; - v531 = hir.load v530 : i64; - v532 = hir.bitcast v495 : u32; - v1108 = arith.constant 4 : u32; - v534 = arith.mod v532, v1108 : u32; - hir.assertz v534 #[code = 250]; - v535 = hir.int_to_ptr v532 : ptr; - hir.store v535, v531; - v1107 = arith.constant 16 : i32; - v537 = arith.add v501, v1107 : i32 #[overflow = wrapping]; - v538 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v539 = hir.bitcast v538 : ptr; - hir.store v539, v537; + hir.store v530, v526; + v1100 = arith.constant 16 : i32; + v532 = arith.add v515, v1100 : i32 #[overflow = wrapping]; + v533 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v534 = hir.bitcast v533 : ptr; + hir.store v534, v532; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v540: felt, v541: felt) -> i32 { - ^block62(v540: felt, v541: felt): - v542 = arith.eq v540, v541 : i1; - v543 = hir.cast v542 : i32; - builtin.ret v543; + private builtin.function @intrinsics::felt::eq(v535: felt, v536: felt) -> i32 { + ^block62(v535: felt, v536: felt): + v537 = arith.eq v535, v536 : i1; + v538 = hir.cast v537 : i32; + builtin.ret v538; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v545: i32, v546: i32, v547: i32) { - ^block64(v545: i32, v546: i32, v547: i32): - v549 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v550 = hir.bitcast v549 : ptr; - v551 = hir.load v550 : i32; - v552 = arith.constant 16 : i32; - v553 = arith.sub v551, v552 : i32 #[overflow = wrapping]; - v554 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v555 = hir.bitcast v554 : ptr; - hir.store v555, v553; - v556 = arith.constant 4 : i32; - v557 = arith.add v553, v556 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v557, v545, v546, v547) - v559 = arith.constant 8 : u32; - v558 = hir.bitcast v553 : u32; - v560 = arith.add v558, v559 : u32 #[overflow = checked]; - v561 = arith.constant 4 : u32; - v562 = arith.mod v560, v561 : u32; - hir.assertz v562 #[code = 250]; - v563 = hir.int_to_ptr v560 : ptr; - v564 = hir.load v563 : i32; - v1118 = arith.constant 0 : i32; - v548 = arith.constant 0 : i32; - v566 = arith.eq v564, v548 : i1; - v567 = arith.zext v566 : u32; - v568 = hir.bitcast v567 : i32; - v570 = arith.neq v568, v1118 : i1; - scf.if v570{ + private builtin.function @::alloc_impl(v540: i32, v541: i32, v542: i32, v543: i32) { + ^block64(v540: i32, v541: i32, v542: i32, v543: i32): + v1117 = arith.constant 0 : i32; + v544 = arith.constant 0 : i32; + v545 = arith.eq v542, v544 : i1; + v546 = arith.zext v545 : u32; + v547 = hir.bitcast v546 : i32; + v549 = arith.neq v547, v1117 : i1; + v1113 = scf.if v549 : i32 { ^block145: - scf.yield ; + scf.yield v541; } else { ^block67: - v1117 = arith.constant 4 : u32; - v571 = hir.bitcast v553 : u32; - v573 = arith.add v571, v1117 : u32 #[overflow = checked]; - v1116 = arith.constant 4 : u32; - v575 = arith.mod v573, v1116 : u32; - hir.assertz v575 #[code = 250]; - v576 = hir.int_to_ptr v573 : ptr; - v577 = hir.load v576 : i32; - v579 = arith.constant 12 : u32; - v578 = hir.bitcast v553 : u32; - v580 = arith.add v578, v579 : u32 #[overflow = checked]; - v1115 = arith.constant 4 : u32; - v582 = arith.mod v580, v1115 : u32; - hir.assertz v582 #[code = 250]; - v583 = hir.int_to_ptr v580 : ptr; - v584 = hir.load v583 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v577, v564, v584) - scf.yield ; + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v1116 = arith.constant 0 : i32; + v551 = arith.neq v543, v1116 : i1; + v1112 = scf.if v551 : i32 { + ^block68: + v553 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v542, v541) : i32 + scf.yield v553; + } else { + ^block69: + v552 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v542, v541) : i32 + scf.yield v552; + }; + scf.yield v1112; }; - v1114 = arith.constant 16 : i32; - v587 = arith.add v553, v1114 : i32 #[overflow = wrapping]; - v588 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v589 = hir.bitcast v588 : ptr; - hir.store v589, v587; + v557 = arith.constant 4 : u32; + v556 = hir.bitcast v540 : u32; + v558 = arith.add v556, v557 : u32 #[overflow = checked]; + v1115 = arith.constant 4 : u32; + v560 = arith.mod v558, v1115 : u32; + hir.assertz v560 #[code = 250]; + v561 = hir.int_to_ptr v558 : ptr; + hir.store v561, v542; + v563 = hir.bitcast v540 : u32; + v1114 = arith.constant 4 : u32; + v565 = arith.mod v563, v1114 : u32; + hir.assertz v565 #[code = 250]; + v566 = hir.int_to_ptr v563 : ptr; + hir.store v566, v1113; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32) { - ^block68(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32): - v597 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v598 = hir.bitcast v597 : ptr; - v599 = hir.load v598 : i32; - v600 = arith.constant 16 : i32; - v601 = arith.sub v599, v600 : i32 #[overflow = wrapping]; - v602 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v603 = hir.bitcast v602 : ptr; - hir.store v603, v601; - v613 = hir.bitcast v591 : u32; - v614 = arith.zext v613 : u64; - v615 = hir.bitcast v614 : i64; - v595 = arith.constant 0 : i32; - v608 = arith.sub v595, v593 : i32 #[overflow = wrapping]; - v605 = arith.constant -1 : i32; - v604 = arith.add v593, v594 : i32 #[overflow = wrapping]; - v606 = arith.add v604, v605 : i32 #[overflow = wrapping]; - v609 = arith.band v606, v608 : i32; - v610 = hir.bitcast v609 : u32; - v611 = arith.zext v610 : u64; - v612 = hir.bitcast v611 : i64; - v616 = arith.mul v612, v615 : i64 #[overflow = wrapping]; - v1222 = arith.constant 0 : i32; - v617 = arith.constant 32 : i64; - v619 = hir.cast v617 : u32; - v618 = hir.bitcast v616 : u64; - v620 = arith.shr v618, v619 : u64; - v621 = hir.bitcast v620 : i64; - v622 = arith.trunc v621 : i32; - v624 = arith.neq v622, v1222 : i1; - v1134, v1135, v1136, v1137, v1138, v1139 = scf.if v624 : i32, i32, i32, i32, i32, u32 { - ^block147: - v1119 = arith.constant 0 : u32; - v1126 = ub.poison i32 : i32; - scf.yield v590, v601, v1126, v1126, v1126, v1119; + private builtin.function @::deallocate(v567: i32, v568: i32, v569: i32) { + ^block70(v567: i32, v568: i32, v569: i32): + v571 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v572 = hir.bitcast v571 : ptr; + v573 = hir.load v572 : i32; + v574 = arith.constant 16 : i32; + v575 = arith.sub v573, v574 : i32 #[overflow = wrapping]; + v576 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v577 = hir.bitcast v576 : ptr; + hir.store v577, v575; + v578 = arith.constant 4 : i32; + v579 = arith.add v575, v578 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::current_memory(v579, v567, v568, v569) + v581 = arith.constant 8 : u32; + v580 = hir.bitcast v575 : u32; + v582 = arith.add v580, v581 : u32 #[overflow = checked]; + v583 = arith.constant 4 : u32; + v584 = arith.mod v582, v583 : u32; + hir.assertz v584 #[code = 250]; + v585 = hir.int_to_ptr v582 : ptr; + v586 = hir.load v585 : i32; + v1124 = arith.constant 0 : i32; + v570 = arith.constant 0 : i32; + v588 = arith.eq v586, v570 : i1; + v589 = arith.zext v588 : u32; + v590 = hir.bitcast v589 : i32; + v592 = arith.neq v590, v1124 : i1; + scf.if v592{ + ^block148: + scf.yield ; } else { ^block73: - v625 = arith.trunc v616 : i32; - v1221 = arith.constant 0 : i32; - v626 = arith.constant -2147483648 : i32; - v627 = arith.sub v626, v593 : i32 #[overflow = wrapping]; - v629 = hir.bitcast v627 : u32; - v628 = hir.bitcast v625 : u32; - v630 = arith.lte v628, v629 : i1; - v631 = arith.zext v630 : u32; - v632 = hir.bitcast v631 : i32; - v634 = arith.neq v632, v1221 : i1; - v1182 = scf.if v634 : i32 { - ^block71: - v1220 = arith.constant 0 : i32; - v645 = arith.neq v625, v1220 : i1; - v1181 = scf.if v645 : i32 { - ^block75: - v1219 = arith.constant 0 : i32; - v661 = arith.neq v592, v1219 : i1; - v1180 = scf.if v661 : i32 { - ^block78: - v643 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v601, v593, v625, v643) - v672 = hir.bitcast v601 : u32; - v717 = arith.constant 4 : u32; - v674 = arith.mod v672, v717 : u32; - hir.assertz v674 #[code = 250]; - v675 = hir.int_to_ptr v672 : ptr; - v676 = hir.load v675 : i32; - scf.yield v676; - } else { - ^block79: - v662 = arith.constant 8 : i32; - v663 = arith.add v601, v662 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v663, v593, v625) - v647 = arith.constant 8 : u32; - v664 = hir.bitcast v601 : u32; - v666 = arith.add v664, v647 : u32 #[overflow = checked]; - v1218 = arith.constant 4 : u32; - v668 = arith.mod v666, v1218 : u32; - hir.assertz v668 #[code = 250]; - v669 = hir.int_to_ptr v666 : ptr; - v670 = hir.load v669 : i32; - scf.yield v670; - }; - v1216 = arith.constant 0 : i32; - v1217 = arith.constant 0 : i32; - v679 = arith.eq v1180, v1217 : i1; - v680 = arith.zext v679 : u32; - v681 = hir.bitcast v680 : i32; - v683 = arith.neq v681, v1216 : i1; - scf.if v683{ - ^block80: - v1215 = arith.constant 8 : u32; - v700 = hir.bitcast v590 : u32; - v702 = arith.add v700, v1215 : u32 #[overflow = checked]; - v1214 = arith.constant 4 : u32; - v704 = arith.mod v702, v1214 : u32; - hir.assertz v704 #[code = 250]; - v705 = hir.int_to_ptr v702 : ptr; - hir.store v705, v625; - v1213 = arith.constant 4 : u32; - v707 = hir.bitcast v590 : u32; - v709 = arith.add v707, v1213 : u32 #[overflow = checked]; - v1212 = arith.constant 4 : u32; - v711 = arith.mod v709, v1212 : u32; - hir.assertz v711 #[code = 250]; - v712 = hir.int_to_ptr v709 : ptr; - hir.store v712, v593; - scf.yield ; - } else { - ^block81: - v1211 = arith.constant 8 : u32; - v685 = hir.bitcast v590 : u32; - v687 = arith.add v685, v1211 : u32 #[overflow = checked]; - v1210 = arith.constant 4 : u32; - v689 = arith.mod v687, v1210 : u32; - hir.assertz v689 #[code = 250]; - v690 = hir.int_to_ptr v687 : ptr; - hir.store v690, v1180; - v1209 = arith.constant 4 : u32; - v692 = hir.bitcast v590 : u32; - v694 = arith.add v692, v1209 : u32 #[overflow = checked]; - v1208 = arith.constant 4 : u32; - v696 = arith.mod v694, v1208 : u32; - hir.assertz v696 #[code = 250]; - v697 = hir.int_to_ptr v694 : ptr; - hir.store v697, v591; - scf.yield ; - }; - v1206 = arith.constant 0 : i32; - v1207 = arith.constant 1 : i32; - v1179 = cf.select v683, v1207, v1206 : i32; - scf.yield v1179; - } else { - ^block76: - v1205 = arith.constant 8 : u32; - v646 = hir.bitcast v590 : u32; - v648 = arith.add v646, v1205 : u32 #[overflow = checked]; - v1204 = arith.constant 4 : u32; - v650 = arith.mod v648, v1204 : u32; - hir.assertz v650 #[code = 250]; - v651 = hir.int_to_ptr v648 : ptr; - hir.store v651, v593; - v1203 = arith.constant 4 : u32; - v654 = hir.bitcast v590 : u32; - v656 = arith.add v654, v1203 : u32 #[overflow = checked]; - v1202 = arith.constant 4 : u32; - v658 = arith.mod v656, v1202 : u32; - hir.assertz v658 #[code = 250]; - v1201 = arith.constant 0 : i32; - v659 = hir.int_to_ptr v656 : ptr; - hir.store v659, v1201; - v1200 = arith.constant 0 : i32; - scf.yield v1200; - }; - scf.yield v1181; - } else { - ^block74: - v1199 = ub.poison i32 : i32; - scf.yield v1199; - }; - v1194 = arith.constant 0 : u32; - v1127 = arith.constant 1 : u32; - v1187 = cf.select v634, v1127, v1194 : u32; - v1195 = ub.poison i32 : i32; - v1186 = cf.select v634, v601, v1195 : i32; - v1196 = ub.poison i32 : i32; - v1185 = cf.select v634, v590, v1196 : i32; - v1197 = ub.poison i32 : i32; - v1184 = cf.select v634, v1197, v601 : i32; - v1198 = ub.poison i32 : i32; - v1183 = cf.select v634, v1198, v590 : i32; - scf.yield v1183, v1184, v1185, v1182, v1186, v1187; - }; - v1140, v1141, v1142 = scf.index_switch v1139 : i32, i32, i32 - case 0 { - ^block72: - v1193 = arith.constant 4 : u32; - v637 = hir.bitcast v1134 : u32; - v639 = arith.add v637, v1193 : u32 #[overflow = checked]; - v1192 = arith.constant 4 : u32; - v641 = arith.mod v639, v1192 : u32; - hir.assertz v641 #[code = 250]; - v1191 = arith.constant 0 : i32; - v642 = hir.int_to_ptr v639 : ptr; - hir.store v642, v1191; - v1190 = arith.constant 1 : i32; - scf.yield v1134, v1190, v1135; - } - default { - ^block151: - scf.yield v1136, v1137, v1138; + v1123 = arith.constant 4 : u32; + v593 = hir.bitcast v575 : u32; + v595 = arith.add v593, v1123 : u32 #[overflow = checked]; + v1122 = arith.constant 4 : u32; + v597 = arith.mod v595, v1122 : u32; + hir.assertz v597 #[code = 250]; + v598 = hir.int_to_ptr v595 : ptr; + v599 = hir.load v598 : i32; + v601 = arith.constant 12 : u32; + v600 = hir.bitcast v575 : u32; + v602 = arith.add v600, v601 : u32 #[overflow = checked]; + v1121 = arith.constant 4 : u32; + v604 = arith.mod v602, v1121 : u32; + hir.assertz v604 #[code = 250]; + v605 = hir.int_to_ptr v602 : ptr; + v606 = hir.load v605 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v599, v586, v606) + scf.yield ; }; - v716 = hir.bitcast v1140 : u32; - v1189 = arith.constant 4 : u32; - v718 = arith.mod v716, v1189 : u32; - hir.assertz v718 #[code = 250]; - v719 = hir.int_to_ptr v716 : ptr; - hir.store v719, v1141; - v1188 = arith.constant 16 : i32; - v724 = arith.add v1142, v1188 : i32 #[overflow = wrapping]; - v725 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v726 = hir.bitcast v725 : ptr; - hir.store v726, v724; + v1120 = arith.constant 16 : i32; + v609 = arith.add v575, v1120 : 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 @::allocate(v727: i32, v728: i32, v729: i32) { - ^block82(v727: i32, v728: i32, v729: i32): - v731 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v732 = hir.bitcast v731 : ptr; - v733 = hir.load v732 : i32; - v734 = arith.constant 16 : i32; - v735 = arith.sub v733, v734 : i32 #[overflow = wrapping]; - v736 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v737 = hir.bitcast v736 : ptr; - hir.store v737, v735; - v730 = arith.constant 0 : i32; - v738 = arith.constant 8 : i32; - v739 = arith.add v735, v738 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v739, v728, v729, v730) - v742 = arith.constant 12 : u32; - v741 = hir.bitcast v735 : u32; - v743 = arith.add v741, v742 : u32 #[overflow = checked]; - v744 = arith.constant 4 : u32; - v745 = arith.mod v743, v744 : u32; - hir.assertz v745 #[code = 250]; - v746 = hir.int_to_ptr v743 : ptr; - v747 = hir.load v746 : i32; - v749 = arith.constant 8 : u32; - v748 = hir.bitcast v735 : u32; - v750 = arith.add v748, v749 : u32 #[overflow = checked]; - v1227 = arith.constant 4 : u32; - v752 = arith.mod v750, v1227 : u32; - hir.assertz v752 #[code = 250]; - v753 = hir.int_to_ptr v750 : ptr; - v754 = hir.load v753 : i32; - v755 = hir.bitcast v727 : u32; - v1226 = arith.constant 4 : u32; - v757 = arith.mod v755, v1226 : u32; - hir.assertz v757 #[code = 250]; - v758 = hir.int_to_ptr v755 : ptr; - hir.store v758, v754; - v1225 = arith.constant 4 : u32; - v759 = hir.bitcast v727 : u32; - v761 = arith.add v759, v1225 : u32 #[overflow = checked]; - v1224 = arith.constant 4 : u32; - v763 = arith.mod v761, v1224 : u32; - hir.assertz v763 #[code = 250]; - v764 = hir.int_to_ptr v761 : ptr; - hir.store v764, v747; - v1223 = arith.constant 16 : i32; - v766 = arith.add v735, v1223 : i32 #[overflow = wrapping]; - v767 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v768 = hir.bitcast v767 : ptr; - hir.store v768, v766; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v769: i32, v770: i32, v771: i32, v772: i32) { - ^block84(v769: i32, v770: i32, v771: i32, v772: i32): - v1243 = arith.constant 0 : i32; - v773 = arith.constant 0 : i32; - v774 = arith.eq v771, v773 : i1; - v775 = arith.zext v774 : u32; - v776 = hir.bitcast v775 : i32; - v778 = arith.neq v776, v1243 : i1; - v1239 = scf.if v778 : i32 { - ^block154: - scf.yield v770; + private builtin.function @::current_memory(v612: i32, v613: i32, v614: i32, v615: i32) { + ^block74(v612: i32, v613: i32, v614: i32, v615: i32): + v1150 = arith.constant 0 : i32; + v616 = arith.constant 0 : i32; + v620 = arith.eq v615, v616 : i1; + v621 = arith.zext v620 : u32; + v622 = hir.bitcast v621 : i32; + v624 = arith.neq v622, v1150 : i1; + v1137, v1138 = scf.if v624 : i32, i32 { + ^block151: + v1149 = arith.constant 0 : i32; + v618 = arith.constant 4 : i32; + scf.yield v618, v1149; } else { - ^block87: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1242 = arith.constant 0 : i32; - v780 = arith.neq v772, v1242 : i1; - v1238 = scf.if v780 : i32 { - ^block88: - v782 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v771, v770) : i32 - scf.yield v782; + ^block77: + v625 = hir.bitcast v613 : u32; + v660 = arith.constant 4 : u32; + v627 = arith.mod v625, v660 : u32; + hir.assertz v627 #[code = 250]; + v628 = hir.int_to_ptr v625 : ptr; + v629 = hir.load v628 : i32; + v1147 = arith.constant 0 : i32; + v1148 = arith.constant 0 : i32; + v631 = arith.eq v629, v1148 : i1; + v632 = arith.zext v631 : u32; + v633 = hir.bitcast v632 : i32; + v635 = arith.neq v633, v1147 : i1; + v1135 = scf.if v635 : i32 { + ^block150: + v1146 = arith.constant 0 : i32; + scf.yield v1146; } else { - ^block89: - v781 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v771, v770) : i32 - scf.yield v781; + ^block78: + v1145 = arith.constant 4 : u32; + v636 = hir.bitcast v612 : u32; + v638 = arith.add v636, v1145 : u32 #[overflow = checked]; + v1144 = arith.constant 4 : u32; + v640 = arith.mod v638, v1144 : u32; + hir.assertz v640 #[code = 250]; + v641 = hir.int_to_ptr v638 : ptr; + hir.store v641, v614; + v1143 = arith.constant 4 : u32; + v642 = hir.bitcast v613 : u32; + v644 = arith.add v642, v1143 : u32 #[overflow = checked]; + v1142 = arith.constant 4 : u32; + v646 = arith.mod v644, v1142 : u32; + hir.assertz v646 #[code = 250]; + v647 = hir.int_to_ptr v644 : ptr; + v648 = hir.load v647 : i32; + v649 = hir.bitcast v612 : u32; + v1141 = arith.constant 4 : u32; + v651 = arith.mod v649, v1141 : u32; + hir.assertz v651 #[code = 250]; + v652 = hir.int_to_ptr v649 : ptr; + hir.store v652, v648; + v653 = arith.mul v629, v615 : i32 #[overflow = wrapping]; + scf.yield v653; }; - scf.yield v1238; + v654 = arith.constant 8 : i32; + v1140 = arith.constant 4 : i32; + v1136 = cf.select v635, v1140, v654 : i32; + scf.yield v1136, v1135; }; - v786 = arith.constant 4 : u32; - v785 = hir.bitcast v769 : u32; - v787 = arith.add v785, v786 : u32 #[overflow = checked]; - v1241 = arith.constant 4 : u32; - v789 = arith.mod v787, v1241 : u32; - hir.assertz v789 #[code = 250]; - v790 = hir.int_to_ptr v787 : ptr; - hir.store v790, v771; - v792 = hir.bitcast v769 : u32; - v1240 = arith.constant 4 : u32; - v794 = arith.mod v792, v1240 : u32; - hir.assertz v794 #[code = 250]; - v795 = hir.int_to_ptr v792 : ptr; - hir.store v795, v1239; + v657 = arith.add v612, v1137 : i32 #[overflow = wrapping]; + v659 = hir.bitcast v657 : u32; + v1139 = arith.constant 4 : u32; + v661 = arith.mod v659, v1139 : u32; + hir.assertz v661 #[code = 250]; + v662 = hir.int_to_ptr v659 : ptr; + hir.store v662, v1138; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v796: i32, v797: i32, v798: i32, v799: i32) { - ^block90(v796: i32, v797: i32, v798: i32, v799: i32): - v1269 = arith.constant 0 : i32; - v800 = arith.constant 0 : i32; - v804 = arith.eq v799, v800 : i1; - v805 = arith.zext v804 : u32; - v806 = hir.bitcast v805 : i32; - v808 = arith.neq v806, v1269 : i1; - v1256, v1257 = scf.if v808 : i32, i32 { - ^block158: - v1268 = arith.constant 0 : i32; - v802 = arith.constant 4 : i32; - scf.yield v802, v1268; + private builtin.function @::deallocate(v663: i32, v664: i32, v665: i32) { + ^block79(v663: i32, v664: i32, v665: i32): + v1152 = arith.constant 0 : i32; + v666 = arith.constant 0 : i32; + v667 = arith.eq v665, v666 : i1; + v668 = arith.zext v667 : u32; + v669 = hir.bitcast v668 : i32; + v671 = arith.neq v669, v1152 : i1; + scf.if v671{ + ^block81: + scf.yield ; } else { - ^block93: - v809 = hir.bitcast v797 : u32; - v844 = arith.constant 4 : u32; - v811 = arith.mod v809, v844 : u32; - hir.assertz v811 #[code = 250]; - v812 = hir.int_to_ptr v809 : ptr; - v813 = hir.load v812 : i32; - v1266 = arith.constant 0 : i32; - v1267 = arith.constant 0 : i32; - v815 = arith.eq v813, v1267 : i1; - v816 = arith.zext v815 : u32; - v817 = hir.bitcast v816 : i32; - v819 = arith.neq v817, v1266 : i1; - v1254 = scf.if v819 : i32 { - ^block157: - v1265 = arith.constant 0 : i32; - scf.yield v1265; - } else { - ^block94: - v1264 = arith.constant 4 : u32; - v820 = hir.bitcast v796 : u32; - v822 = arith.add v820, v1264 : u32 #[overflow = checked]; - v1263 = arith.constant 4 : u32; - v824 = arith.mod v822, v1263 : u32; - hir.assertz v824 #[code = 250]; - v825 = hir.int_to_ptr v822 : ptr; - hir.store v825, v798; - v1262 = arith.constant 4 : u32; - v826 = hir.bitcast v797 : u32; - v828 = arith.add v826, v1262 : u32 #[overflow = checked]; - v1261 = arith.constant 4 : u32; - v830 = arith.mod v828, v1261 : u32; - hir.assertz v830 #[code = 250]; - v831 = hir.int_to_ptr v828 : ptr; - v832 = hir.load v831 : i32; - v833 = hir.bitcast v796 : u32; - v1260 = arith.constant 4 : u32; - v835 = arith.mod v833, v1260 : u32; - hir.assertz v835 #[code = 250]; - v836 = hir.int_to_ptr v833 : ptr; - hir.store v836, v832; - v837 = arith.mul v813, v799 : i32 #[overflow = wrapping]; - scf.yield v837; - }; - v838 = arith.constant 8 : i32; - v1259 = arith.constant 4 : i32; - v1255 = cf.select v819, v1259, v838 : i32; - scf.yield v1255, v1254; + ^block82: + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v663, v665, v664) + scf.yield ; }; - v841 = arith.add v796, v1256 : i32 #[overflow = wrapping]; - v843 = hir.bitcast v841 : u32; - v1258 = arith.constant 4 : u32; - v845 = arith.mod v843, v1258 : u32; - hir.assertz v845 #[code = 250]; - v846 = hir.int_to_ptr v843 : ptr; - hir.store v846, v1257; builtin.ret ; }; - private builtin.function @::deallocate(v847: i32, v848: i32, v849: i32) { - ^block95(v847: i32, v848: i32, v849: i32): - v1271 = arith.constant 0 : i32; - v850 = arith.constant 0 : i32; - v851 = arith.eq v849, v850 : i1; - v852 = arith.zext v851 : u32; - v853 = hir.bitcast v852 : i32; - v855 = arith.neq v853, v1271 : i1; - scf.if v855{ - ^block97: - scf.yield ; + private builtin.function @::allocate(v672: i32, v673: i32, v674: i32) { + ^block83(v672: i32, v673: i32, v674: i32): + v676 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v677 = hir.bitcast v676 : ptr; + v678 = hir.load v677 : i32; + v679 = arith.constant 16 : i32; + v680 = arith.sub v678, v679 : i32 #[overflow = wrapping]; + v681 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v682 = hir.bitcast v681 : ptr; + hir.store v682, v680; + v675 = arith.constant 0 : i32; + v683 = arith.constant 8 : i32; + v684 = arith.add v680, v683 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v684, v673, v674, v675) + v687 = arith.constant 12 : u32; + v686 = hir.bitcast v680 : u32; + v688 = arith.add v686, v687 : u32 #[overflow = checked]; + v689 = arith.constant 4 : u32; + v690 = arith.mod v688, v689 : u32; + hir.assertz v690 #[code = 250]; + v691 = hir.int_to_ptr v688 : ptr; + v692 = hir.load v691 : i32; + v694 = arith.constant 8 : u32; + v693 = hir.bitcast v680 : u32; + v695 = arith.add v693, v694 : u32 #[overflow = checked]; + v1157 = arith.constant 4 : u32; + v697 = arith.mod v695, v1157 : u32; + hir.assertz v697 #[code = 250]; + v698 = hir.int_to_ptr v695 : ptr; + v699 = hir.load v698 : i32; + v700 = hir.bitcast v672 : u32; + v1156 = arith.constant 4 : u32; + v702 = arith.mod v700, v1156 : u32; + hir.assertz v702 #[code = 250]; + v703 = hir.int_to_ptr v700 : ptr; + hir.store v703, v699; + v1155 = arith.constant 4 : u32; + v704 = hir.bitcast v672 : u32; + v706 = arith.add v704, v1155 : u32 #[overflow = checked]; + v1154 = arith.constant 4 : u32; + v708 = arith.mod v706, v1154 : u32; + hir.assertz v708 #[code = 250]; + v709 = hir.int_to_ptr v706 : ptr; + hir.store v709, v692; + v1153 = arith.constant 16 : i32; + v711 = arith.add v680, v1153 : i32 #[overflow = wrapping]; + v712 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v713 = hir.bitcast v712 : ptr; + hir.store v713, v711; + builtin.ret ; + }; + + private builtin.function @::try_allocate_in(v714: i32, v715: i32, v716: i32, v717: i32, v718: i32) { + ^block85(v714: i32, v715: i32, v716: i32, v717: i32, v718: i32): + v721 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v722 = hir.bitcast v721 : ptr; + v723 = hir.load v722 : i32; + v724 = arith.constant 16 : i32; + v725 = arith.sub v723, v724 : i32 #[overflow = wrapping]; + v726 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v727 = hir.bitcast v726 : ptr; + hir.store v727, v725; + v737 = hir.bitcast v715 : u32; + v738 = arith.zext v737 : u64; + v739 = hir.bitcast v738 : i64; + v719 = arith.constant 0 : i32; + v732 = arith.sub v719, v717 : i32 #[overflow = wrapping]; + v729 = arith.constant -1 : i32; + v728 = arith.add v717, v718 : i32 #[overflow = wrapping]; + v730 = arith.add v728, v729 : i32 #[overflow = wrapping]; + v733 = arith.band v730, v732 : i32; + v734 = hir.bitcast v733 : u32; + v735 = arith.zext v734 : u64; + v736 = hir.bitcast v735 : i64; + v740 = arith.mul v736, v739 : i64 #[overflow = wrapping]; + v1260 = arith.constant 0 : i32; + v741 = arith.constant 32 : i64; + v743 = hir.cast v741 : u32; + v742 = hir.bitcast v740 : u64; + v744 = arith.shr v742, v743 : u64; + v745 = hir.bitcast v744 : i64; + v746 = arith.trunc v745 : i32; + v748 = arith.neq v746, v1260 : i1; + v1173, v1174, v1175, v1176, v1177, v1178 = scf.if v748 : i32, i32, i32, i32, i32, u32 { + ^block155: + v1158 = arith.constant 0 : u32; + v1165 = ub.poison i32 : i32; + scf.yield v714, v725, v1165, v1165, v1165, v1158; } else { - ^block98: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v847, v849, v848) - scf.yield ; + ^block90: + v749 = arith.trunc v740 : i32; + v1259 = arith.constant 0 : i32; + v750 = arith.constant -2147483648 : i32; + v751 = arith.sub v750, v717 : i32 #[overflow = wrapping]; + v753 = hir.bitcast v751 : u32; + v752 = hir.bitcast v749 : u32; + v754 = arith.lte v752, v753 : i1; + v755 = arith.zext v754 : u32; + v756 = hir.bitcast v755 : i32; + v758 = arith.neq v756, v1259 : i1; + v1221 = scf.if v758 : i32 { + ^block88: + v1258 = arith.constant 0 : i32; + v769 = arith.neq v749, v1258 : i1; + v1220 = scf.if v769 : i32 { + ^block92: + v1257 = arith.constant 0 : i32; + v785 = arith.neq v716, v1257 : i1; + v1219 = scf.if v785 : i32 { + ^block95: + v767 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v725, v717, v749, v767) + v796 = hir.bitcast v725 : u32; + v837 = arith.constant 4 : u32; + v798 = arith.mod v796, v837 : u32; + hir.assertz v798 #[code = 250]; + v799 = hir.int_to_ptr v796 : ptr; + v800 = hir.load v799 : i32; + scf.yield v800; + } else { + ^block96: + v786 = arith.constant 8 : i32; + v787 = arith.add v725, v786 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v787, v717, v749) + v771 = arith.constant 8 : u32; + v788 = hir.bitcast v725 : u32; + v790 = arith.add v788, v771 : u32 #[overflow = checked]; + v1256 = arith.constant 4 : u32; + v792 = arith.mod v790, v1256 : u32; + hir.assertz v792 #[code = 250]; + v793 = hir.int_to_ptr v790 : ptr; + v794 = hir.load v793 : i32; + scf.yield v794; + }; + v1255 = arith.constant 0 : i32; + v803 = arith.neq v1219, v1255 : i1; + scf.if v803{ + ^block97: + v1254 = arith.constant 8 : u32; + v820 = hir.bitcast v714 : u32; + v822 = arith.add v820, v1254 : u32 #[overflow = checked]; + v1253 = arith.constant 4 : u32; + v824 = arith.mod v822, v1253 : u32; + hir.assertz v824 #[code = 250]; + v825 = hir.int_to_ptr v822 : ptr; + hir.store v825, v1219; + v1252 = arith.constant 4 : u32; + v827 = hir.bitcast v714 : u32; + v829 = arith.add v827, v1252 : u32 #[overflow = checked]; + v1251 = arith.constant 4 : u32; + v831 = arith.mod v829, v1251 : u32; + hir.assertz v831 #[code = 250]; + v832 = hir.int_to_ptr v829 : ptr; + hir.store v832, v715; + scf.yield ; + } else { + ^block98: + v1250 = arith.constant 8 : u32; + v806 = hir.bitcast v714 : u32; + v808 = arith.add v806, v1250 : u32 #[overflow = checked]; + v1249 = arith.constant 4 : u32; + v810 = arith.mod v808, v1249 : u32; + hir.assertz v810 #[code = 250]; + v811 = hir.int_to_ptr v808 : ptr; + hir.store v811, v749; + v1248 = arith.constant 4 : u32; + v813 = hir.bitcast v714 : u32; + v815 = arith.add v813, v1248 : u32 #[overflow = checked]; + v1247 = arith.constant 4 : u32; + v817 = arith.mod v815, v1247 : u32; + hir.assertz v817 #[code = 250]; + v818 = hir.int_to_ptr v815 : ptr; + hir.store v818, v717; + scf.yield ; + }; + v1245 = arith.constant 1 : i32; + v1246 = arith.constant 0 : i32; + v1218 = cf.select v803, v1246, v1245 : i32; + scf.yield v1218; + } else { + ^block93: + v1244 = arith.constant 8 : u32; + v770 = hir.bitcast v714 : u32; + v772 = arith.add v770, v1244 : u32 #[overflow = checked]; + v1243 = arith.constant 4 : u32; + v774 = arith.mod v772, v1243 : u32; + hir.assertz v774 #[code = 250]; + v775 = hir.int_to_ptr v772 : ptr; + hir.store v775, v717; + v1242 = arith.constant 4 : u32; + v778 = hir.bitcast v714 : u32; + v780 = arith.add v778, v1242 : u32 #[overflow = checked]; + v1241 = arith.constant 4 : u32; + v782 = arith.mod v780, v1241 : u32; + hir.assertz v782 #[code = 250]; + v1240 = arith.constant 0 : i32; + v783 = hir.int_to_ptr v780 : ptr; + hir.store v783, v1240; + v1239 = arith.constant 0 : i32; + scf.yield v1239; + }; + scf.yield v1220; + } else { + ^block91: + v1238 = ub.poison i32 : i32; + scf.yield v1238; + }; + v1233 = arith.constant 0 : u32; + v1166 = arith.constant 1 : u32; + v1226 = cf.select v758, v1166, v1233 : u32; + v1234 = ub.poison i32 : i32; + v1225 = cf.select v758, v725, v1234 : i32; + v1235 = ub.poison i32 : i32; + v1224 = cf.select v758, v714, v1235 : i32; + v1236 = ub.poison i32 : i32; + v1223 = cf.select v758, v1236, v725 : i32; + v1237 = ub.poison i32 : i32; + v1222 = cf.select v758, v1237, v714 : i32; + scf.yield v1222, v1223, v1224, v1221, v1225, v1226; }; + v1179, v1180, v1181 = scf.index_switch v1178 : i32, i32, i32 + case 0 { + ^block89: + v1232 = arith.constant 4 : u32; + v761 = hir.bitcast v1173 : u32; + v763 = arith.add v761, v1232 : u32 #[overflow = checked]; + v1231 = arith.constant 4 : u32; + v765 = arith.mod v763, v1231 : u32; + hir.assertz v765 #[code = 250]; + v1230 = arith.constant 0 : i32; + v766 = hir.int_to_ptr v763 : ptr; + hir.store v766, v1230; + v1229 = arith.constant 1 : i32; + scf.yield v1173, v1229, v1174; + } + default { + ^block159: + scf.yield v1175, v1176, v1177; + }; + v836 = hir.bitcast v1179 : u32; + v1228 = arith.constant 4 : u32; + v838 = arith.mod v836, v1228 : u32; + hir.assertz v838 #[code = 250]; + v839 = hir.int_to_ptr v836 : ptr; + hir.store v839, v1180; + v1227 = arith.constant 16 : i32; + v844 = arith.add v1181, v1227 : i32 #[overflow = wrapping]; + v845 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v846 = hir.bitcast v845 : ptr; + hir.store v846, v844; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v856: i32, v857: i32, v858: i32) { - ^block99(v856: i32, v857: i32, v858: i32): + private builtin.function @alloc::raw_vec::handle_error(v847: i32, v848: i32) { + ^block99(v847: i32, v848: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v859: i32, v860: i32) -> i32 { - ^block101(v859: i32, v860: i32): - v867 = arith.constant 0 : i32; - v863 = hir.bitcast v860 : u32; - v862 = hir.bitcast v859 : u32; - v864 = arith.gt v862, v863 : i1; - v865 = arith.zext v864 : u32; - v866 = hir.bitcast v865 : i32; - v868 = arith.neq v866, v867 : i1; - v869 = cf.select v868, v859, v860 : i32; - builtin.ret v869; + private builtin.function @::max(v849: i32, v850: i32) -> i32 { + ^block101(v849: i32, v850: i32): + v857 = arith.constant 0 : i32; + v853 = hir.bitcast v850 : u32; + v852 = hir.bitcast v849 : u32; + v854 = arith.gt v852, v853 : i1; + v855 = arith.zext v854 : u32; + v856 = hir.bitcast v855 : i32; + v858 = arith.neq v856, v857 : i1; + v859 = cf.select v858, v849, v850 : i32; + builtin.ret v859; }; - private builtin.function @miden::active_account::get_id(v870: i32) { - ^block103(v870: i32): - v871, v872 = hir.exec @miden/active_account/get_id() : felt, felt - v873 = hir.bitcast v870 : u32; - v874 = hir.int_to_ptr v873 : ptr; - hir.store v874, v871; - v875 = arith.constant 4 : u32; - v876 = arith.add v873, v875 : u32 #[overflow = checked]; - v877 = hir.int_to_ptr v876 : ptr; - hir.store v877, v872; + private builtin.function @miden::active_account::get_id(v860: i32) { + ^block103(v860: i32): + v861, v862 = hir.exec @miden/active_account/get_id() : felt, felt + v863 = hir.bitcast v860 : u32; + v864 = hir.int_to_ptr v863 : ptr; + hir.store v864, v861; + v865 = arith.constant 4 : u32; + v866 = arith.add v863, v865 : u32 #[overflow = checked]; + v867 = hir.int_to_ptr v866 : ptr; + hir.store v867, v862; builtin.ret ; }; - private builtin.function @miden::active_note::get_inputs(v878: i32) -> i32 { - ^block107(v878: i32): - v879, v880 = hir.exec @miden/active_note/get_inputs(v878) : i32, i32 - builtin.ret v879; + private builtin.function @miden::active_note::get_assets(v868: i32) -> i32 { + ^block107(v868: i32): + v869, v870 = hir.exec @miden/active_note/get_assets(v868) : i32, i32 + builtin.ret v869; }; - private builtin.function @miden::active_note::get_assets(v882: i32) -> i32 { - ^block110(v882: i32): - v883, v884 = hir.exec @miden/active_note/get_assets(v882) : i32, i32 - builtin.ret v883; + private builtin.function @miden::active_note::get_inputs(v872: i32) -> i32 { + ^block110(v872: i32): + v873, v874 = hir.exec @miden/active_note/get_inputs(v872) : i32, i32 + builtin.ret v873; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1278,14 +1269,12 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x003e64657463616465723c; - - builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; + builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v886: felt, v887: felt, v888: felt, v889: felt) { - ^block112(v886: felt, v887: felt, v888: felt, v889: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v886, v887, v888, v889) + public builtin.function @run(v876: felt, v877: felt, v878: felt, v879: felt) { + ^block112(v876: felt, v877: felt, v878: felt, v879: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v876, v877, v878, v879) 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 9de7b752f..725ed2437 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -16,20 +16,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[3747760794384071571,1766386520481277932,2198275188940187258,538857382178104910] + push.[511068398781876708,4034132635148770913,11946245983825022717,413851799653899214] adv.push_mapval push.262144 - push.3 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + mem_store.278537 end # mod miden:base/note-script@1.0.0::p2id @@ -57,7 +57,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -65,7 +65,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048616 + push.1048588 u32wrapping_add movup.2 swap.1 @@ -85,7 +85,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -93,7 +93,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048616 + push.1048588 u32wrapping_add dup.1 swap.2 @@ -181,7 +181,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -191,7 +191,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop push.48 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -629,7 +629,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate + exec.::miden:base/note-script@1.0.0::p2id::::deallocate trace.252 nop push.4 @@ -641,12 +641,12 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate + exec.::miden:base/note-script@1.0.0::p2id::::deallocate trace.252 nop push.48 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -682,7 +682,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -690,7 +690,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048620 + push.1048592 u32wrapping_add u32divmod.4 swap.1 @@ -711,7 +711,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -725,7 +725,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048620 + push.1048592 movup.2 u32wrapping_add u32divmod.4 @@ -783,7 +783,7 @@ proc ::alloc( movup.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::core::ptr::alignment::Alignment::max + exec.::miden:base/note-script@1.0.0::p2id::::max trace.252 nop push.0 @@ -944,8 +944,10 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc alloc::vec::Vec::with_capacity(i32) - push.1114176 +proc >::with_capacity( + i32 +) + push.1114144 u32divmod.4 swap.1 trace.240 @@ -955,7 +957,7 @@ proc alloc::vec::Vec::with_capacity(i32) nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -974,7 +976,7 @@ proc alloc::vec::Vec::with_capacity(i32) swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::with_capacity_in + exec.::miden:base/note-script@1.0.0::p2id::::with_capacity_in trace.252 nop push.8 @@ -1032,7 +1034,7 @@ proc alloc::vec::Vec::with_capacity(i32) nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1043,12 +1045,12 @@ proc alloc::vec::Vec::with_capacity(i32) end @callconv("C") -proc alloc::raw_vec::RawVecInner::with_capacity_in( +proc ::with_capacity_in( i32, i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1058,7 +1060,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1081,7 +1083,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( movdn.3 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::try_allocate_in + exec.::miden:base/note-script@1.0.0::p2id::::try_allocate_in trace.252 nop push.8 @@ -1174,7 +1176,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1185,16 +1187,8 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( else movup.2 drop - push.1114180 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.12 - movup.3 + movup.2 add u32assert push.4 @@ -1210,10 +1204,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 - movup.2 - u32wrapping_add - swap.2 + swap.1 trace.240 nop exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::handle_error @@ -1225,10 +1216,10 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( end @callconv("C") -proc miden_base_sys::bindings::active_account::get_id( +proc miden_base_sys::bindings::active_note::get_assets( i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1238,7 +1229,7 @@ proc miden_base_sys::bindings::active_account::get_id( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1248,15 +1239,57 @@ proc miden_base_sys::bindings::active_account::get_id( exec.::intrinsics::mem::store_sw trace.252 nop - push.8 + push.4 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::>::with_capacity + 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.2 + swap.1 + swap.1 + u32shr + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_assets trace.252 nop push.8 + dup.3 + 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 + push.4 dup.1 add u32assert @@ -1275,7 +1308,7 @@ proc miden_base_sys::bindings::active_account::get_id( nop swap.1 movup.3 - push.8 + push.4 dup.1 swap.1 u32mod @@ -1292,7 +1325,7 @@ proc miden_base_sys::bindings::active_account::get_id( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1306,7 +1339,7 @@ end proc miden_base_sys::bindings::active_note::get_inputs( i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1316,7 +1349,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1335,7 +1368,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::with_capacity_in + exec.::miden:base/note-script@1.0.0::p2id::::with_capacity_in trace.252 nop push.8 @@ -1431,7 +1464,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1442,10 +1475,8 @@ proc miden_base_sys::bindings::active_note::get_inputs( end @callconv("C") -proc miden_base_sys::bindings::active_note::get_assets( - i32 -) - push.1114176 +proc miden_base_sys::bindings::active_account::get_id(i32) + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1455,7 +1486,7 @@ proc miden_base_sys::bindings::active_note::get_assets( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1465,12 +1496,12 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop - push.4 + push.8 dup.1 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::vec::Vec::with_capacity + exec.::miden:base/note-script@1.0.0::p2id::miden::active_account::get_id trace.252 nop push.8 @@ -1487,22 +1518,12 @@ proc miden_base_sys::bindings::active_note::get_assets( swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::load_dw trace.252 nop - push.2 - swap.1 swap.1 - u32shr - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_assets - trace.252 - nop + movup.3 push.8 - dup.3 - u32wrapping_add - push.4 dup.1 swap.1 u32mod @@ -1510,13 +1531,75 @@ proc miden_base_sys::bindings::active_note::get_assets( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + 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 intrinsics::felt::eq(felt, felt) -> i32 + eq +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.::miden:base/note-script@1.0.0::p2id::__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.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_alloc + trace.252 + nop + end + end push.4 - dup.1 + dup.2 add u32assert push.4 @@ -1525,15 +1608,16 @@ proc miden_base_sys::bindings::active_note::get_assets( u32mod u32assert assertz + movup.3 + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop swap.1 - movup.3 push.4 dup.1 swap.1 @@ -1542,18 +1626,6 @@ proc miden_base_sys::bindings::active_note::get_assets( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - u32wrapping_add - push.1114176 - u32divmod.4 - swap.1 trace.240 nop exec.::intrinsics::mem::store_sw @@ -1562,17 +1634,12 @@ proc miden_base_sys::bindings::active_note::get_assets( end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +proc ::deallocate( i32, i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1582,7 +1649,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1602,7 +1669,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::current_memory + exec.::miden:base/note-script@1.0.0::p2id::::current_memory trace.252 nop push.8 @@ -1673,7 +1740,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1684,393 +1751,122 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( - i32, +proc ::current_memory( i32, i32, i32, i32 ) - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114176 - 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 + dup.5 + eq neq if.true + movdn.3 drop drop - movup.2 - drop - movup.2 - drop - movup.2 drop push.0 - push.3735929054 - dup.0 + push.4 + else + dup.1 + push.4 dup.1 - swap.4 swap.1 - swap.3 - swap.5 - else - drop + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 push.0 - push.2147483648 - dup.7 - u32wrapping_sub dup.2 - swap.1 - u32lte + eq 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.::miden:base/note-script@1.0.0::p2id::alloc::alloc::Global::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.::miden:base/note-script@1.0.0::p2id::::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 - push.0 - dup.2 - eq - neq - dup.0 - if.true - 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 - else - 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 - end - push.0 - push.1 - 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 + movup.2 drop - movup.3 + movup.2 drop - movup.3 + movup.2 drop - push.3735929054 + 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.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.8 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 + movup.3 + cdrop end + movup.2 + u32wrapping_add push.4 dup.1 swap.1 @@ -2084,16 +1880,32 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - push.16 - u32wrapping_add - push.1114176 - 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.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_dealloc + trace.252 + nop + end end @callconv("C") @@ -2102,7 +1914,7 @@ proc ::allocate( i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -2112,7 +1924,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -2135,7 +1947,7 @@ proc ::allocate( swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::alloc::Global::alloc_impl + exec.::miden:base/note-script@1.0.0::p2id::::alloc_impl trace.252 nop push.12 @@ -2205,211 +2017,402 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114176 + 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 + 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 -end - -@callconv("C") -proc alloc::alloc::Global::alloc_impl( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq + drop neq if.true - movup.3 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 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop + drop push.0 - movup.4 + push.2147483648 + dup.7 + u32wrapping_sub + dup.2 + swap.1 + u32lte neq + dup.0 if.true - swap.1 + push.0 dup.2 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_alloc_zeroed - trace.252 - nop + neq + if.true + push.0 + movup.6 + neq + if.true + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::::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.::miden:base/note-script@1.0.0::p2id::::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 - dup.2 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_alloc - trace.252 - nop + 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 - 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 alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq + movup.5 + eq.0 if.true - movdn.3 + movup.2 drop + movup.2 drop + movup.2 drop - push.0 push.4 - else 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::load_sw + exec.::intrinsics::mem::store_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 + push.1 + swap.1 + else + drop + drop end - movup.2 - u32wrapping_add push.4 dup.1 swap.1 @@ -2423,37 +2426,20 @@ proc alloc::raw_vec::RawVecInner::current_memory( 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 ::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.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_dealloc - trace.252 - nop - end -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop +proc alloc::raw_vec::handle_error(i32, i32) drop drop push.0 @@ -2461,7 +2447,10 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) end @callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 +proc ::max( + i32, + i32 +) -> i32 push.0 dup.2 dup.2 @@ -2502,10 +2491,10 @@ proc miden::active_account::get_id(i32) end @callconv("C") -proc miden::active_note::get_inputs(i32) -> i32 +proc miden::active_note::get_assets(i32) -> i32 trace.240 nop - exec.::miden::active_note::get_inputs + exec.::miden::active_note::get_assets trace.252 nop swap.1 @@ -2513,10 +2502,10 @@ proc miden::active_note::get_inputs(i32) -> i32 end @callconv("C") -proc miden::active_note::get_assets(i32) -> i32 +proc miden::active_note::get_inputs(i32) -> i32 trace.240 nop - exec.::miden::active_note::get_assets + exec.::miden::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 2b16cf8cd..4f5df28e9 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,18 +10,18 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (alias export 0 "asset" (type (;1;))) - (type (;2;) + (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))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) + (type $ty-miden:basic-wallet/basic-wallet@0.1.0 (;2;) (instance - (alias outer 1 1 (type (;0;))) + (alias outer 1 $asset (type (;0;))) (export (;1;) "asset" (type (eq 0))) (type (;2;) (func (param "asset" 1))) (export (;0;) "receive-asset" (func (type 2))) ) ) - (import "miden:basic-wallet/basic-wallet@0.1.0" (instance (;1;) (type 2))) - (core module (;0;) + (import "miden:basic-wallet/basic-wallet@0.1.0" (instance $miden:basic-wallet/basic-wallet@0.1.0 (;1;) (type $ty-miden:basic-wallet/basic-wallet@0.1.0))) + (core module $main (;0;) (type (;0;) (func (param f32 f32 f32 f32))) (type (;1;) (func)) (type (;2;) (func (param i32 i32) (result i32))) @@ -30,9 +30,10 @@ (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 i32))) - (type (;9;) (func (param i32 i32 i32 i32))) - (type (;10;) (func (param i32) (result i32))) + (type (;8;) (func (param i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32 i32 i32))) + (type (;10;) (func (param i32 i32))) + (type (;11;) (func (param i32) (result i32))) (import "miden:basic-wallet/basic-wallet@0.1.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -44,7 +45,7 @@ (func $__wasm_call_ctors (;1;) (type 1)) (func $__rustc::__rust_alloc (;2;) (type 2) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048616 + i32.const 1048588 i32.add local.get 1 local.get 0 @@ -54,7 +55,7 @@ (func $__rustc::__rust_alloc_zeroed (;4;) (type 2) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048616 + i32.const 1048588 i32.add local.get 1 local.get 0 @@ -171,13 +172,13 @@ i32.add i32.const 16 i32.const 16 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 4 i32.const 16 i32.add i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 4 i32.const 48 i32.add @@ -193,7 +194,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048620 + i32.const 1048592 i32.add i32.load8_u br_if 0 (;@1;) @@ -201,7 +202,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048620 + i32.const 1048592 i32.add i32.const 1 i32.store8 @@ -226,7 +227,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -282,7 +283,7 @@ (func $intrinsics::mem::heap_base (;10;) (type 5) (result i32) unreachable ) - (func $alloc::vec::Vec::with_capacity (;11;) (type 6) (param i32) + (func $>::with_capacity (;11;) (type 6) (param i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -294,7 +295,7 @@ i32.add i32.const 16 i32.const 16 - call $alloc::raw_vec::RawVecInner::with_capacity_in + call $::with_capacity_in local.get 1 i64.load offset=8 local.set 2 @@ -309,7 +310,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;12;) (type 3) (param i32 i32 i32) + (func $::with_capacity_in (;12;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -323,7 +324,7 @@ i32.const 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::try_allocate_in + call $::try_allocate_in local.get 3 i32.load offset=8 local.set 2 @@ -333,14 +334,9 @@ i32.const 1 i32.ne br_if 0 (;@1;) - global.get $GOT.data.internal.__memory_base - local.set 0 local.get 2 local.get 3 i32.load offset=12 - local.get 0 - i32.const 1048600 - i32.add call $alloc::raw_vec::handle_error unreachable end @@ -356,7 +352,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_account::get_id (;13;) (type 6) (param i32) + (func $miden_base_sys::bindings::active_note::get_assets (;13;) (type 6) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -364,13 +360,22 @@ 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 - call $miden::active_account::get_id + local.get 1 + i32.load offset=8 + i32.const 2 + i32.shr_u + call $miden::active_note::get_assets + i32.store local.get 0 local.get 1 - i64.load offset=8 align=4 - i64.store + i64.load offset=4 align=4 + i64.store align=4 local.get 1 i32.const 16 i32.add @@ -388,7 +393,7 @@ i32.add i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::with_capacity_in + call $::with_capacity_in local.get 1 i32.load offset=8 local.set 2 @@ -411,7 +416,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_assets (;15;) (type 6) (param i32) + (func $miden_base_sys::bindings::active_account::get_id (;15;) (type 6) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -419,22 +424,13 @@ local.tee 1 global.set $__stack_pointer local.get 1 - i32.const 4 - i32.add - call $alloc::vec::Vec::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::active_note::get_assets - i32.store + call $miden::active_account::get_id local.get 0 local.get 1 - i64.load offset=4 align=4 - i64.store align=4 + i64.load offset=8 align=4 + i64.store local.get 1 i32.const 16 i32.add @@ -443,7 +439,34 @@ (func $intrinsics::felt::eq (;16;) (type 7) (param f32 f32) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;17;) (type 3) (param i32 i32 i32) + (func $::alloc_impl (;17;) (type 8) (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 (;18;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -456,7 +479,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -475,7 +498,82 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;18;) (type 8) (param i32 i32 i32 i32 i32) + (func $::current_memory (;19;) (type 8) (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 (;20;) (type 3) (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 (;21;) (type 3) (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 (;22;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -551,32 +649,31 @@ local.get 3 local.get 4 i32.const 1 - call $alloc::alloc::Global::alloc_impl + call $::alloc_impl local.get 5 i32.load local.set 2 end block ;; label = @2 local.get 2 - i32.eqz br_if 0 (;@2;) local.get 0 - local.get 2 + local.get 4 i32.store offset=8 local.get 0 - local.get 1 + local.get 3 i32.store offset=4 - i32.const 0 + i32.const 1 local.set 3 br 1 (;@1;) end local.get 0 - local.get 4 + local.get 2 i32.store offset=8 local.get 0 - local.get 3 + local.get 1 i32.store offset=4 - i32.const 1 + i32.const 0 local.set 3 end local.get 0 @@ -587,112 +684,10 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;19;) (type 3) (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::alloc::Global::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 $alloc::alloc::Global::alloc_impl (;20;) (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 $alloc::raw_vec::RawVecInner::current_memory (;21;) (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 (;22;) (type 3) (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 $alloc::raw_vec::handle_error (;23;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;23;) (type 10) (param i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;24;) (type 2) (param i32 i32) (result i32) + (func $::max (;24;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -703,32 +698,31 @@ (func $miden::active_account::get_id (;25;) (type 6) (param i32) unreachable ) - (func $miden::active_note::get_inputs (;26;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_assets (;26;) (type 11) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_assets (;27;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_inputs (;27;) (type 11) (param i32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "\00") - (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;3;))) - (alias export 1 "receive-asset" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (core instance (;0;) - (export "receive-asset" (func 0)) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;3;))) + (alias export $miden:basic-wallet/basic-wallet@0.1.0 "receive-asset" (func $receive-asset (;0;))) + (core func $receive-asset (;0;) (canon lower (func $receive-asset))) + (core instance $miden:basic-wallet/basic-wallet@0.1.0 (;0;) + (export "receive-asset" (func $receive-asset)) ) - (core instance (;1;) (instantiate 0 - (with "miden:basic-wallet/basic-wallet@0.1.0" (instance 0)) + (core instance $main (;1;) (instantiate $main + (with "miden:basic-wallet/basic-wallet@0.1.0" (instance $miden:basic-wallet/basic-wallet@0.1.0)) ) ) - (alias core export 1 "memory" (core memory (;0;))) - (type (;4;) (func (param "arg" 3))) - (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;1;))) - (func (;1;) (type 4) (canon lift (core func 1))) - (alias export 0 "felt" (type (;5;))) - (alias export 0 "word" (type (;6;))) - (component (;0;) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;4;) (func (param "arg" $word))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;1;))) + (func $run (;1;) (type 4) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;5;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type6 word" (@name "word") (;6;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -741,12 +735,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;2;) (instantiate 0 - (with "import-func-run" (func 1)) - (with "import-type-felt" (type 5)) - (with "import-type-word" (type 6)) - (with "import-type-word0" (type 3)) + (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type6 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) + (export $miden:base/note-script@1.0.0 (;3;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/examples/storage_example.hir b/tests/integration/expected/examples/storage_example.hir index 874485c15..7938feb44 100644 --- a/tests/integration/expected/examples/storage_example.hir +++ b/tests/integration/expected/examples/storage_example.hir @@ -10,247 +10,314 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.ret ; }; - private builtin.function @miden:storage-example/foo@1.0.0#set-asset-qty(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt) { - ^block9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt): + 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; - v13 = hir.load v12 : i32; - v14 = arith.constant 112 : i32; - v15 = arith.sub v13, v14 : i32 #[overflow = wrapping]; - v16 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v17 = hir.bitcast v16 : ptr; - hir.store v17, v15; + hir.store v12, v10; hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 0 : i32; - v19 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v9) : felt - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::active_account::get_item(v19, v15) - v21 = arith.constant 8 : u32; - v20 = hir.bitcast v15 : u32; - v22 = arith.add v20, v21 : u32 #[overflow = checked]; + 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; + }; + + 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; + 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; - v24 = arith.mod v22, v547 : u32; - hir.assertz v24 #[code = 250]; - v25 = hir.int_to_ptr v22 : ptr; - v26 = hir.load v25 : i64; - v28 = arith.constant 56 : u32; - v27 = hir.bitcast v15 : u32; - v29 = arith.add v27, v28 : u32 #[overflow = checked]; + 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; - v31 = arith.mod v29, v546 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v26; - v33 = hir.bitcast v15 : u32; - v545 = arith.constant 8 : u32; - v35 = arith.mod v33, v545 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - v37 = hir.load v36 : i64; - v39 = arith.constant 48 : u32; - v38 = hir.bitcast v15 : u32; - v40 = arith.add v38, v39 : u32 #[overflow = checked]; - v544 = arith.constant 8 : u32; - v42 = arith.mod v40, v544 : u32; - hir.assertz v42 #[code = 250]; - v43 = hir.int_to_ptr v40 : ptr; - hir.store v43, v37; - v46 = arith.constant 48 : i32; - v47 = arith.add v15, v46 : i32 #[overflow = wrapping]; - v44 = arith.constant 96 : i32; - v45 = arith.add v15, v44 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v45, v47) - v49 = arith.constant 100 : u32; - v48 = hir.bitcast v15 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v51 = arith.constant 4 : u32; - v52 = arith.mod v50, v51 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : felt; - v56 = arith.constant 104 : u32; - v55 = hir.bitcast v15 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; + 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; - v59 = arith.mod v57, v543 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : felt; - v63 = arith.constant 108 : u32; - v62 = hir.bitcast v15 : u32; - v64 = arith.add v62, v63 : u32 #[overflow = checked]; - v542 = arith.constant 4 : u32; - v66 = arith.mod v64, v542 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - v68 = hir.load v67 : felt; - v70 = arith.constant 96 : u32; - v69 = hir.bitcast v15 : u32; - v71 = arith.add v69, v70 : u32 #[overflow = checked]; - v541 = arith.constant 4 : u32; - v73 = arith.mod v71, v541 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - v75 = hir.load v74 : felt; - v76 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v0, v75) : i32 - v540 = arith.constant 0 : i32; - v77 = arith.constant 1 : i32; - v78 = arith.neq v76, v77 : i1; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v540 : i1; - scf.if v82{ + 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: scf.yield ; } else { - ^block12: - v83 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v1, v54) : i32 - v538 = arith.constant 0 : i32; - v539 = arith.constant 1 : i32; - v85 = arith.neq v83, v539 : i1; - v86 = arith.zext v85 : u32; - v87 = hir.bitcast v86 : i32; - v89 = arith.neq v87, v538 : i1; - scf.if v89{ + ^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: scf.yield ; } else { - ^block13: - v90 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v2, v61) : i32 - v536 = arith.constant 0 : i32; - v537 = arith.constant 1 : i32; - v92 = arith.neq v90, v537 : i1; - v93 = arith.zext v92 : u32; - v94 = hir.bitcast v93 : i32; - v96 = arith.neq v94, v536 : i1; - scf.if v96{ + ^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: scf.yield ; } else { - ^block14: - v97 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v3, v68) : i32 - v534 = arith.constant 0 : i32; - v535 = arith.constant 1 : i32; - v99 = arith.neq v97, v535 : i1; - v100 = arith.zext v99 : u32; - v101 = hir.bitcast v100 : i32; - v103 = arith.neq v101, v534 : i1; - scf.if v103{ + ^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: scf.yield ; } else { - ^block15: - v104 = arith.constant 32 : i32; - v105 = arith.add v15, v104 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v105, v8) - v533 = arith.constant 1 : i32; - v107 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v533) : felt - v109 = arith.constant 44 : u32; - v108 = hir.bitcast v15 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; + ^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; - v112 = arith.mod v110, v532 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v116 = arith.constant 40 : u32; - v115 = hir.bitcast v15 : u32; - v117 = arith.add v115, v116 : u32 #[overflow = checked]; + 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; - v119 = arith.mod v117, v531 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v123 = arith.constant 36 : u32; - v122 = hir.bitcast v15 : u32; - v124 = arith.add v122, v123 : u32 #[overflow = checked]; - v530 = arith.constant 4 : u32; - v126 = arith.mod v124, v530 : u32; - hir.assertz v126 #[code = 250]; - v127 = hir.int_to_ptr v124 : ptr; - v128 = hir.load v127 : felt; - v130 = arith.constant 32 : u32; - v129 = hir.bitcast v15 : u32; - v131 = arith.add v129, v130 : u32 #[overflow = checked]; - v529 = arith.constant 4 : u32; - v133 = arith.mod v131, v529 : u32; - hir.assertz v133 #[code = 250]; - v134 = hir.int_to_ptr v131 : ptr; - v135 = hir.load v134 : felt; - v528 = arith.constant 48 : i32; - v137 = arith.add v15, v528 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::native_account::set_map_item(v107, v7, v6, v5, v4, v114, v121, v128, v135, v137) - v527 = arith.constant 56 : u32; - v138 = hir.bitcast v15 : u32; - v140 = arith.add v138, v527 : u32 #[overflow = checked]; - v526 = arith.constant 8 : u32; - v142 = arith.mod v140, v526 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - v144 = hir.load v143 : i64; - v146 = arith.constant 88 : u32; - v145 = hir.bitcast v15 : u32; - v147 = arith.add v145, v146 : u32 #[overflow = checked]; + 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; + 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; - v149 = arith.mod v147, v525 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v144; - v524 = arith.constant 48 : u32; - v151 = hir.bitcast v15 : u32; - v153 = arith.add v151, v524 : u32 #[overflow = checked]; + 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; - v155 = arith.mod v153, v523 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - v157 = hir.load v156 : i64; - v159 = arith.constant 80 : u32; - v158 = hir.bitcast v15 : u32; - v160 = arith.add v158, v159 : u32 #[overflow = checked]; + v224 = arith.mod v222, v523 : 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; - v162 = arith.mod v160, v522 : u32; - hir.assertz v162 #[code = 250]; - v163 = hir.int_to_ptr v160 : ptr; - hir.store v163, v157; - v164 = arith.constant 72 : i32; - v165 = arith.add v15, v164 : i32 #[overflow = wrapping]; - v166 = hir.bitcast v165 : 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; - v168 = arith.mod v166, v521 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : i64; - v520 = arith.constant 104 : u32; - v171 = hir.bitcast v15 : u32; - v173 = arith.add v171, v520 : u32 #[overflow = checked]; - v519 = arith.constant 8 : u32; - v175 = arith.mod v173, v519 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - hir.store v176, v170; - v178 = arith.constant 64 : u32; - v177 = hir.bitcast v15 : u32; - v179 = arith.add v177, v178 : u32 #[overflow = checked]; - v518 = arith.constant 8 : u32; - v181 = arith.mod v179, v518 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - v183 = hir.load v182 : i64; - v517 = arith.constant 96 : u32; - v184 = hir.bitcast v15 : u32; - v186 = arith.add v184, v517 : u32 #[overflow = checked]; - v516 = arith.constant 8 : u32; - v188 = arith.mod v186, v516 : u32; - hir.assertz v188 #[code = 250]; - v189 = hir.int_to_ptr v186 : ptr; - hir.store v189, v183; - v190 = arith.constant 80 : i32; - v191 = arith.add v15, v190 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v15, v191) - v515 = arith.constant 96 : i32; - v195 = arith.add v15, v515 : i32 #[overflow = wrapping]; - v192 = arith.constant 16 : i32; - v193 = arith.add v15, v192 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v193, v195) + 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) scf.yield ; }; scf.yield ; @@ -259,79 +326,12 @@ builtin.component miden:storage-example/foo@1.0.0 { }; scf.yield ; }; - v514 = arith.constant 112 : i32; - v198 = arith.add v15, v514 : i32 #[overflow = wrapping]; - v199 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v200 = hir.bitcast v199 : ptr; - hir.store v200, v198; - builtin.ret ; - }; - - private builtin.function @miden:storage-example/foo@1.0.0#get-asset-qty(v201: felt, v202: felt, v203: felt, v204: felt) -> felt { - ^block16(v201: felt, v202: felt, v203: felt, v204: felt): - v207 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v208 = hir.bitcast v207 : ptr; - v209 = hir.load v208 : i32; - v210 = arith.constant 48 : i32; - v211 = arith.sub v209, v210 : i32 #[overflow = wrapping]; - v212 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v213 = hir.bitcast v212 : ptr; - hir.store v213, v211; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() - v214 = arith.constant 1 : i32; - v215 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v214) : felt - v216 = arith.constant 16 : i32; - v217 = arith.add v211, v216 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::active_account::get_map_item(v215, v204, v203, v202, v201, v217) - v219 = arith.constant 24 : u32; - v218 = hir.bitcast v211 : u32; - v220 = arith.add v218, v219 : u32 #[overflow = checked]; - v221 = arith.constant 8 : u32; - v222 = arith.mod v220, v221 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - v224 = hir.load v223 : i64; - v226 = arith.constant 40 : u32; - v225 = hir.bitcast v211 : u32; - v227 = arith.add v225, v226 : u32 #[overflow = checked]; - v551 = arith.constant 8 : u32; - v229 = arith.mod v227, v551 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - hir.store v230, v224; - v232 = arith.constant 16 : u32; - v231 = hir.bitcast v211 : u32; - v233 = arith.add v231, v232 : u32 #[overflow = checked]; - v550 = arith.constant 8 : u32; - v235 = arith.mod v233, v550 : u32; - hir.assertz v235 #[code = 250]; - v236 = hir.int_to_ptr v233 : ptr; - v237 = hir.load v236 : i64; - v239 = arith.constant 32 : u32; - v238 = hir.bitcast v211 : u32; - v240 = arith.add v238, v239 : u32 #[overflow = checked]; - v549 = arith.constant 8 : u32; - v242 = arith.mod v240, v549 : u32; - hir.assertz v242 #[code = 250]; - v243 = hir.int_to_ptr v240 : ptr; - hir.store v243, v237; - v244 = arith.constant 32 : i32; - v245 = arith.add v211, v244 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v211, v245) - v247 = arith.constant 12 : u32; - v246 = hir.bitcast v211 : u32; - v248 = arith.add v246, v247 : u32 #[overflow = checked]; - v249 = arith.constant 4 : u32; - v250 = arith.mod v248, v249 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - v252 = hir.load v251 : felt; - v548 = arith.constant 48 : i32; - v254 = arith.add v211, v548 : i32 #[overflow = wrapping]; + 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; - builtin.ret v252; + builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { @@ -357,160 +357,160 @@ builtin.component miden:storage-example/foo@1.0.0 { v271 = hir.bitcast v270 : ptr; v272 = hir.load v271 : i32; hir.exec @miden:storage-example/foo@1.0.0/storage_example/__wasm_call_ctors() - v553 = arith.constant 1 : u8; - v555 = arith.constant 1048584 : i32; - v274 = arith.add v272, v555 : i32 #[overflow = wrapping]; + 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, v553; + hir.store v279, v551; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v280: i32) -> felt { - ^block22(v280: i32): - v282 = arith.constant 255 : i32; - v283 = arith.band v280, v282 : i32; - v284 = hir.bitcast v283 : felt; - builtin.ret v284; - }; - - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v285: i32, v286: i32) { - ^block24(v285: i32, v286: i32): - v289 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v290 = hir.bitcast v289 : ptr; - v291 = hir.load v290 : i32; - v292 = arith.constant 16 : i32; - v293 = arith.sub v291, v292 : i32 #[overflow = wrapping]; - v295 = arith.constant 8 : u32; - v294 = hir.bitcast v286 : u32; - v296 = arith.add v294, v295 : u32 #[overflow = checked]; - v642 = arith.constant 8 : u32; - v298 = arith.mod v296, v642 : u32; - hir.assertz v298 #[code = 250]; - v299 = hir.int_to_ptr v296 : ptr; - v300 = hir.load v299 : i64; - v641 = arith.constant 8 : u32; - v301 = hir.bitcast v293 : u32; - v303 = arith.add v301, v641 : u32 #[overflow = checked]; - v304 = arith.constant 4 : u32; - v305 = arith.mod v303, v304 : u32; - hir.assertz v305 #[code = 250]; - v306 = hir.int_to_ptr v303 : ptr; - hir.store v306, v300; - v307 = hir.bitcast v286 : u32; + 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; - v309 = arith.mod v307, v640 : 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; + 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; - v311 = hir.load v310 : i64; - v312 = hir.bitcast v293 : u32; - v639 = arith.constant 4 : u32; - v314 = arith.mod v312, v639 : u32; - hir.assertz v314 #[code = 250]; - v315 = hir.int_to_ptr v312 : ptr; - hir.store v315, v311; - v316 = arith.constant 12 : i32; - v317 = arith.add v293, v316 : i32 #[overflow = wrapping]; - v287 = arith.constant 0 : i32; - v610, v611, v612, v613, v614, v615 = scf.while v287, v293, v317, v285 : i32, i32, i32, i32, i32, i32 { - ^block65(v616: i32, v617: i32, v618: i32, v619: i32): - v638 = arith.constant 0 : i32; - v320 = arith.constant 8 : i32; - v321 = arith.eq v616, v320 : i1; - v322 = arith.zext v321 : u32; - v323 = hir.bitcast v322 : i32; - v325 = arith.neq v323, v638 : i1; - v604, v605 = scf.if v325 : i32, i32 { + 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: - v564 = ub.poison i32 : i32; - scf.yield v564, v564; + v562 = ub.poison i32 : i32; + scf.yield v562, v562; } else { - ^block29: - v327 = arith.add v617, v616 : i32 #[overflow = wrapping]; - v328 = hir.bitcast v327 : u32; - v637 = arith.constant 4 : u32; - v330 = arith.mod v328, v637 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - v332 = hir.load v331 : felt; - v334 = hir.bitcast v618 : u32; - v636 = arith.constant 4 : u32; - v336 = arith.mod v334, v636 : u32; - hir.assertz v336 #[code = 250]; - v337 = hir.int_to_ptr v334 : ptr; - v338 = hir.load v337 : i32; - v339 = hir.bitcast v327 : u32; + ^block27: + v322 = arith.add v615, v614 : i32 #[overflow = wrapping]; + v323 = hir.bitcast v322 : u32; v635 = arith.constant 4 : u32; - v341 = arith.mod v339, v635 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v338; - v343 = hir.bitcast v618 : 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; - v345 = arith.mod v343, v634 : u32; - hir.assertz v345 #[code = 250]; - v346 = hir.int_to_ptr v343 : ptr; - hir.store v346, v332; - v349 = arith.constant -4 : i32; - v350 = arith.add v618, v349 : i32 #[overflow = wrapping]; - v347 = arith.constant 4 : i32; - v348 = arith.add v616, v347 : i32 #[overflow = wrapping]; - scf.yield v348, v350; + 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; }; - v632 = ub.poison i32 : i32; - v607 = cf.select v325, v632, v619 : i32; - v633 = ub.poison i32 : i32; - v606 = cf.select v325, v633, v617 : i32; - v563 = arith.constant 1 : u32; - v556 = arith.constant 0 : u32; - v609 = cf.select v325, v556, v563 : u32; - v597 = arith.trunc v609 : i1; - scf.condition v597, v604, v606, v605, v607, v617, v619; + 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(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32, v625: i32): - scf.yield v620, v621, v622, v623; + ^block66(v618: i32, v619: i32, v620: i32, v621: i32, v622: i32, v623: i32): + scf.yield v618, v619, v620, v621; }; - v631 = arith.constant 8 : u32; - v352 = hir.bitcast v614 : u32; - v354 = arith.add v352, v631 : u32 #[overflow = checked]; - v630 = arith.constant 4 : u32; - v356 = arith.mod v354, v630 : u32; - hir.assertz v356 #[code = 250]; - v357 = hir.int_to_ptr v354 : ptr; - v358 = hir.load v357 : i64; v629 = arith.constant 8 : u32; - v359 = hir.bitcast v615 : u32; - v361 = arith.add v359, v629 : u32 #[overflow = checked]; - v628 = arith.constant 8 : u32; - v363 = arith.mod v361, v628 : u32; - hir.assertz v363 #[code = 250]; - v364 = hir.int_to_ptr v361 : ptr; - hir.store v364, v358; - v365 = hir.bitcast v614 : u32; - v627 = arith.constant 4 : u32; - v367 = arith.mod v365, v627 : 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; - v369 = hir.load v368 : i64; - v370 = hir.bitcast v615 : u32; - v626 = arith.constant 8 : u32; - v372 = arith.mod v370, v626 : u32; - hir.assertz v372 #[code = 250]; - v373 = hir.int_to_ptr v370 : ptr; - hir.store v373, v369; + hir.store v368, v364; 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 - v648 = arith.constant 0 : i32; - v380 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v648) : felt - v647 = arith.constant 0 : i32; - v382 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v647) : 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]; @@ -522,38 +522,38 @@ builtin.component miden:storage-example/foo@1.0.0 { v390 = arith.constant 8 : u32; v389 = hir.bitcast v374 : u32; v391 = arith.add v389, v390 : u32 #[overflow = checked]; - v646 = arith.constant 4 : u32; - v393 = arith.mod v391, v646 : u32; + 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; - v645 = arith.constant 4 : u32; + v643 = arith.constant 4 : u32; v395 = hir.bitcast v374 : u32; - v397 = arith.add v395, v645 : u32 #[overflow = checked]; - v644 = arith.constant 4 : u32; - v399 = arith.mod v397, v644 : 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; - v643 = arith.constant 4 : u32; - v403 = arith.mod v401, v643 : 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::from_u32(v405: i32) -> felt { - ^block32(v405: i32): - v406 = hir.bitcast v405 : felt; - builtin.ret v406; + 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::eq(v408: felt, v409: felt) -> i32 { - ^block34(v408: felt, v409: felt): - v410 = arith.eq v408, v409 : i1; - v411 = hir.cast v410 : i32; + private builtin.function @intrinsics::felt::from_u32(v410: i32) -> felt { + ^block34(v410: i32): + v411 = hir.bitcast v410 : felt; builtin.ret v411; }; diff --git a/tests/integration/expected/examples/storage_example.masm b/tests/integration/expected/examples/storage_example.masm index 96673bd0a..168718bbe 100644 --- a/tests/integration/expected/examples/storage_example.masm +++ b/tests/integration/expected/examples/storage_example.masm @@ -59,6 +59,172 @@ proc storage_example::bindings::__link_custom_section_describing_imports( nop end +@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 + 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 + swap.1 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::miden::active_account::get_map_item + trace.252 + nop + push.24 + 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.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 + trace.252 + nop + push.16 + 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.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.::miden:storage-example/foo@1.0.0::storage_example::::reverse + 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_felt + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + @callconv("C") proc miden:storage-example/foo@1.0.0#set-asset-qty( felt, @@ -79,7 +245,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_sw trace.252 nop - push.112 + push.128 u32wrapping_sub push.1114144 dup.1 @@ -183,15 +349,15 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( push.48 dup.1 u32wrapping_add - push.96 + push.112 dup.2 u32wrapping_add trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:storage-example/foo@1.0.0::storage_example::::reverse trace.252 nop - push.100 + push.116 dup.1 add u32assert @@ -208,7 +374,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.104 + push.120 dup.2 add u32assert @@ -225,7 +391,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.108 + push.124 dup.3 add u32assert @@ -242,7 +408,7 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.96 + push.112 dup.4 add u32assert @@ -589,191 +755,25 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( dup.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:storage-example/foo@1.0.0::storage_example::::reverse trace.252 nop push.96 dup.1 u32wrapping_add - push.16 + push.112 dup.2 u32wrapping_add trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:storage-example/foo@1.0.0::storage_example::::reverse trace.252 nop end end end end - push.112 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@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 - 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 - swap.1 - trace.240 - nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden::active_account::get_map_item - trace.252 - nop - push.24 - 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.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 - trace.252 - nop - push.16 - 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.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.::miden:storage-example/foo@1.0.0::storage_example::miden_stdlib_sys::intrinsics::word::Word::reverse - 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_felt - trace.252 - nop - push.48 - movup.2 + push.128 u32wrapping_add push.1114144 u32divmod.4 @@ -860,15 +860,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -1144,6 +1136,14 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( nop end +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + @callconv("C") proc >::from( i32, @@ -1237,13 +1237,13 @@ proc felt - nop +proc intrinsics::felt::eq(felt, felt) -> i32 + eq end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") diff --git a/tests/integration/expected/examples/storage_example.wat b/tests/integration/expected/examples/storage_example.wat index ce48da296..b96f99c7a 100644 --- a/tests/integration/expected/examples/storage_example.wat +++ b/tests/integration/expected/examples/storage_example.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,13 +10,13 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32 f32 f32 f32 f32 f32))) - (type (;2;) (func (param f32 f32 f32 f32) (result f32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param i32 i32))) + (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))) @@ -27,15 +27,55 @@ (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:storage-example/foo@1.0.0#set-asset-qty" (func $miden:storage-example/foo@1.0.0#set-asset-qty)) (export "miden:storage-example/foo@1.0.0#get-asset-qty" (func $miden:storage-example/foo@1.0.0#get-asset-qty)) + (export "miden:storage-example/foo@1.0.0#set-asset-qty" (func $miden:storage-example/foo@1.0.0#set-asset-qty)) (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#set-asset-qty (;2;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32 f32) + (func $miden:storage-example/foo@1.0.0#get-asset-qty (;2;) (type 1) (param f32 f32 f32 f32) (result f32) + (local i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 4 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 1 + call $>::from + local.get 3 + local.get 2 + local.get 1 + local.get 0 + local.get 4 + i32.const 16 + i32.add + call $miden::active_account::get_map_item + local.get 4 + 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 + local.set 0 + local.get 4 + i32.const 48 + 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) (local i32 f32 f32 f32) global.get $__stack_pointer - i32.const 112 + i32.const 128 i32.sub local.tee 9 global.set $__stack_pointer @@ -53,25 +93,25 @@ i64.load i64.store offset=48 local.get 9 - i32.const 96 + i32.const 112 i32.add local.get 9 i32.const 48 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 9 - f32.load offset=100 + f32.load offset=116 local.set 10 local.get 9 - f32.load offset=104 + f32.load offset=120 local.set 11 local.get 9 - f32.load offset=108 + f32.load offset=124 local.set 12 block ;; label = @1 local.get 0 local.get 9 - f32.load offset=96 + f32.load offset=112 call $intrinsics::felt::eq i32.const 1 i32.ne @@ -139,60 +179,20 @@ local.get 9 i32.const 80 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 9 - i32.const 16 + i32.const 112 i32.add local.get 9 i32.const 96 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse end local.get 9 - i32.const 112 + i32.const 128 i32.add global.set $__stack_pointer ) - (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.sub - local.tee 4 - global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - i32.const 1 - call $>::from - local.get 3 - local.get 2 - local.get 1 - local.get 0 - local.get 4 - i32.const 16 - i32.add - call $miden::active_account::get_map_item - local.get 4 - 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 $miden_stdlib_sys::intrinsics::word::Word::reverse - local.get 4 - f32.load offset=12 - local.set 0 - local.get 4 - i32.const 48 - i32.add - global.set $__stack_pointer - local.get 0 - ) (func $wit_bindgen::rt::run_ctors_once (;4;) (type 0) (local i32) block ;; label = @1 @@ -211,13 +211,7 @@ i32.store8 end ) - (func $>::from (;5;) (type 3) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;6;) (type 4) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -275,6 +269,12 @@ 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) (local f32 f32 f32) i32.const 0 @@ -299,10 +299,10 @@ local.get 2 f32.store ) - (func $intrinsics::felt::from_u32 (;8;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::eq (;8;) (type 6) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;9;) (type 6) (param f32 f32) (result i32) + (func $intrinsics::felt::from_u32 (;9;) (type 4) (param i32) (result f32) unreachable ) (func $miden::active_account::get_item (;10;) (type 7) (param f32 i32) @@ -317,21 +317,21 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (alias export 0 "word" (type (;2;))) - (alias export 0 "asset" (type (;3;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;4;) (func (param "pub-key" 2) (param "asset" 3) (param "qty" 1))) - (alias core export 0 "miden:storage-example/foo@1.0.0#set-asset-qty" (core func (;0;))) - (func (;0;) (type 4) (canon lift (core func 0))) - (type (;5;) (func (param "asset" 3) (result 1))) - (alias core export 0 "miden:storage-example/foo@1.0.0#get-asset-qty" (core func (;1;))) - (func (;1;) (type 5) (canon lift (core func 1))) - (alias export 0 "felt" (type (;6;))) - (alias export 0 "word" (type (;7;))) - (alias export 0 "asset" (type (;8;))) - (component (;0;) + (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;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;3;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;4;) (func (param "pub-key" $word) (param "asset" $asset) (param "qty" $felt))) + (alias core export $main "miden:storage-example/foo@1.0.0#set-asset-qty" (core func $miden:storage-example/foo@1.0.0#set-asset-qty (;0;))) + (func $set-asset-qty (;0;) (type 4) (canon lift (core func $miden:storage-example/foo@1.0.0#set-asset-qty))) + (type (;5;) (func (param "asset" $asset) (result $felt))) + (alias core export $main "miden:storage-example/foo@1.0.0#get-asset-qty" (core func $miden:storage-example/foo@1.0.0#get-asset-qty (;1;))) + (func $get-asset-qty (;1;) (type 5) (canon lift (core func $miden:storage-example/foo@1.0.0#get-asset-qty))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type6 felt" (@name "felt") (;6;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type7 word" (@name "word") (;7;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type8 asset" (@name "asset") (;8;))) + (component $miden:storage-example/foo@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -354,16 +354,16 @@ (type (;16;) (func (param "asset" 14) (result 12))) (export (;3;) "get-asset-qty" (func 1) (func (type 16))) ) - (instance (;1;) (instantiate 0 - (with "import-func-set-asset-qty" (func 0)) - (with "import-func-get-asset-qty" (func 1)) - (with "import-type-felt" (type 6)) - (with "import-type-word" (type 7)) - (with "import-type-asset" (type 8)) - (with "import-type-word0" (type 2)) - (with "import-type-asset0" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:storage-example/foo@1.0.0-shim-instance (;1;) (instantiate $miden:storage-example/foo@1.0.0-shim-component + (with "import-func-set-asset-qty" (func $set-asset-qty)) + (with "import-func-get-asset-qty" (func $get-asset-qty)) + (with "import-type-felt" (type $"#type6 felt")) + (with "import-type-word" (type $"#type7 word")) + (with "import-type-asset" (type $"#type8 asset")) + (with "import-type-word0" (type $word)) + (with "import-type-asset0" (type $asset)) + (with "import-type-felt0" (type $felt)) ) ) - (export (;2;) "miden:storage-example/foo@1.0.0" (instance 1)) + (export $miden:storage-example/foo@1.0.0 (;2;) "miden:storage-example/foo@1.0.0" (instance $miden:storage-example/foo@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/felt_intrinsics.hir b/tests/integration/expected/felt_intrinsics.hir index bae87be12..1e5c33c21 100644 --- a/tests/integration/expected/felt_intrinsics.hir +++ b/tests/integration/expected/felt_intrinsics.hir @@ -1,66 +1,66 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @felt_intrinsics { - public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { - ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::mul(v0, v1) : felt - v4 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::sub(v3, v0) : felt - v5 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::add(v4, v1) : felt - v6 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::div(v0, v5) : felt - builtin.ret v6; + 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; }; - private builtin.function @__rustc::__rust_alloc(v7: i32, v8: i32) -> i32 { - ^block6(v7: i32, v8: i32): + 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, v8, v7) : i32 - builtin.ret v11; - }; - - private builtin.function @__rustc::__rust_realloc(v12: i32, v13: i32, v14: i32, v15: i32) -> i32 { - ^block8(v12: i32, v13: i32, v14: i32, v15: i32): - v17 = arith.constant 1048580 : i32; - v18 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::alloc(v17, v14, v15) : i32 + v11 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::alloc(v10, v7, v8) : i32 v197 = arith.constant 0 : i32; - v19 = arith.constant 0 : i32; - v20 = arith.eq v18, v19 : i1; - v21 = arith.zext v20 : u32; - v22 = hir.bitcast v21 : i32; - v24 = arith.neq v22, v197 : i1; - scf.if v24{ - ^block10: + 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: scf.yield ; } else { - ^block11: + ^block9: v196 = arith.constant 0 : i32; - v26 = hir.bitcast v13 : u32; - v25 = hir.bitcast v15 : u32; - v27 = arith.lt v25, v26 : i1; - v28 = arith.zext v27 : u32; - v29 = hir.bitcast v28 : i32; - v31 = arith.neq v29, v196 : i1; - v32 = cf.select v31, v15, v13 : 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; - v34 = arith.eq v32, v195 : i1; - v35 = arith.zext v34 : u32; - v36 = hir.bitcast v35 : i32; - v38 = arith.neq v36, v194 : i1; - scf.if v38{ + 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: scf.yield ; } else { - ^block12: - v39 = hir.bitcast v32 : u32; - v40 = hir.bitcast v18 : u32; - v41 = hir.int_to_ptr v40 : ptr; - v42 = hir.bitcast v12 : u32; - v43 = hir.int_to_ptr v42 : ptr; - hir.mem_cpy v43, v41, v39; + ^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; scf.yield ; }; scf.yield ; }; - builtin.ret v18; + builtin.ret v11; + }; + + 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; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -91,7 +91,7 @@ builtin.component root_ns:root@1.0.0 { scf.yield v204, v200; } else { ^block18: - v66 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/core::ptr::alignment::Alignment::max(v46, v59) : i32 + 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]; @@ -199,9 +199,9 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v129; }; - private builtin.function @intrinsics::felt::sub(v131: felt, v132: felt) -> felt { + private builtin.function @intrinsics::felt::div(v131: felt, v132: felt) -> felt { ^block30(v131: felt, v132: felt): - v133 = arith.sub v131, v132 : felt #[overflow = unchecked]; + v133 = arith.div v131, v132 : felt; builtin.ret v133; }; @@ -211,13 +211,13 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v137; }; - private builtin.function @intrinsics::felt::div(v139: felt, v140: felt) -> felt { + private builtin.function @intrinsics::felt::sub(v139: felt, v140: felt) -> felt { ^block34(v139: felt, v140: felt): - v141 = arith.div v139, v140 : felt; + v141 = arith.sub v139, v140 : felt #[overflow = unchecked]; builtin.ret v141; }; - private builtin.function @core::ptr::alignment::Alignment::max(v143: i32, v144: i32) -> i32 { + private builtin.function @::max(v143: i32, v144: i32) -> i32 { ^block36(v143: i32, v144: i32): v151 = arith.constant 0 : i32; v147 = hir.bitcast v144 : u32; @@ -243,56 +243,50 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v163; }; - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v164: i32, v165: i32, v166: i32, v167: i32) -> i32 { + 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 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/wit_bindgen::rt::cabi_realloc(v164, v165, v166, v167) : i32 - builtin.ret v169; - }; - - private builtin.function @wit_bindgen::rt::cabi_realloc(v170: i32, v171: i32, v172: i32, v173: i32) -> i32 { - ^block44(v170: i32, v171: i32, v172: i32, v173: i32): - v175 = arith.constant 0 : i32; - v176 = arith.neq v171, v175 : i1; - v250, v251, v252 = scf.if v176 : i32, i32, u32 { - ^block48: - v184 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/__rustc::__rust_realloc(v170, v171, v172, v173) : 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 v184, v245, v241; + scf.yield v178, v245, v241; } else { - ^block49: + ^block47: v280 = arith.constant 0 : i32; v281 = arith.constant 0 : i32; - v178 = arith.eq v173, v281 : i1; - v179 = arith.zext v178 : u32; - v180 = hir.bitcast v179 : i32; - v182 = arith.neq v180, v280 : i1; - v268 = scf.if v182 : 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; } else { - ^block50: - v183 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/alloc::alloc::alloc(v172, v173) : i32 - scf.yield v183; + ^block48: + v177 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/alloc::alloc::alloc(v166, v167) : i32 + scf.yield v177; }; v277 = arith.constant 0 : u32; v246 = arith.constant 1 : u32; - v270 = cf.select v182, v246, v277 : u32; + v270 = cf.select v176, v246, v277 : u32; v278 = ub.poison i32 : i32; - v269 = cf.select v182, v172, v278 : i32; + v269 = cf.select v176, v166, v278 : i32; scf.yield v268, v269, v270; }; v257, v258 = scf.index_switch v252 : i32, u32 case 0 { - ^block47: + ^block45: v275 = arith.constant 0 : i32; - v187 = arith.neq v250, v275 : i1; + v181 = arith.neq v250, v275 : i1; v272 = arith.constant 1 : u32; v273 = arith.constant 0 : u32; - v267 = cf.select v187, v273, v272 : u32; + v267 = cf.select v181, v273, v272 : u32; v274 = ub.poison i32 : i32; - v266 = cf.select v187, v250, v274 : i32; + v266 = cf.select v181, v250, v274 : i32; scf.yield v266, v267; } default { @@ -309,6 +303,12 @@ builtin.component root_ns:root@1.0.0 { 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; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/felt_intrinsics.wat b/tests/integration/expected/felt_intrinsics.wat index 90b4b3e96..454ed0bc1 100644 --- a/tests/integration/expected/felt_intrinsics.wat +++ b/tests/integration/expected/felt_intrinsics.wat @@ -1,7 +1,7 @@ (module $felt_intrinsics.wasm - (type (;0;) (func (param f32 f32) (result f32))) - (type (;1;) (func (param i32 i32) (result i32))) - (type (;2;) (func (param i32 i32 i32 i32) (result i32))) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32 i32 i32 i32) (result i32))) + (type (;2;) (func (param f32 f32) (result f32))) (type (;3;) (func)) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) @@ -13,24 +13,13 @@ (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 $entrypoint (;0;) (type 0) (param f32 f32) (result f32) - local.get 0 - local.get 0 - local.get 1 - call $intrinsics::felt::mul - local.get 0 - call $intrinsics::felt::sub - local.get 1 - call $intrinsics::felt::add - call $intrinsics::felt::div - ) - (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) + (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_realloc (;2;) (type 2) (param i32 i32 i32 i32) (result i32) + (func $__rustc::__rust_realloc (;1;) (type 1) (param i32 i32 i32 i32) (result i32) block ;; label = @1 i32.const 1048580 local.get 2 @@ -55,6 +44,17 @@ end local.get 2 ) + (func $entrypoint (;2;) (type 2) (param f32 f32) (result f32) + local.get 0 + local.get 0 + local.get 1 + call $intrinsics::felt::mul + local.get 0 + call $intrinsics::felt::sub + local.get 1 + call $intrinsics::felt::add + call $intrinsics::felt::div + ) (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 3) return ) @@ -77,7 +77,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -133,19 +133,19 @@ (func $intrinsics::mem::heap_base (;5;) (type 5) (result i32) unreachable ) - (func $intrinsics::felt::add (;6;) (type 0) (param f32 f32) (result f32) + (func $intrinsics::felt::add (;6;) (type 2) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::sub (;7;) (type 0) (param f32 f32) (result f32) + (func $intrinsics::felt::div (;7;) (type 2) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::mul (;8;) (type 0) (param f32 f32) (result f32) + (func $intrinsics::felt::mul (;8;) (type 2) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::div (;9;) (type 0) (param f32 f32) (result f32) + (func $intrinsics::felt::sub (;9;) (type 2) (param f32 f32) (result f32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;10;) (type 1) (param i32 i32) (result i32) + (func $::max (;10;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -153,27 +153,20 @@ i32.gt_u select ) - (func $cabi_realloc (;11;) (type 2) (param i32 i32 i32 i32) (result i32) + (func $cabi_realloc (;11;) (type 1) (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 (;12;) (type 1) (param i32 i32) (result i32) + (func $alloc::alloc::alloc (;12;) (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 $cabi_realloc_wit_bindgen_0_46_0 (;13;) (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 - ) - (func $wit_bindgen::rt::cabi_realloc (;14;) (type 2) (param i32 i32 i32 i32) (result i32) + (func $wit_bindgen::rt::cabi_realloc (;13;) (type 1) (param i32 i32 i32 i32) (result i32) block ;; label = @1 block ;; label = @2 block ;; label = @3 @@ -201,5 +194,12 @@ end local.get 2 ) + (func $cabi_realloc_wit_bindgen_0_46_0 (;14;) (type 1) (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/hash_elements.hir b/tests/integration/expected/hash_elements.hir index d9bb0af50..f3dc1f906 100644 --- a/tests/integration/expected/hash_elements.hir +++ b/tests/integration/expected/hash_elements.hir @@ -1,120 +1,120 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @hash_elements { - public builtin.function @entrypoint(v0: i32) -> felt { - ^block4(v0: i32): - v4 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v5 = hir.bitcast v4 : ptr; - v6 = hir.load v5 : i32; - v7 = arith.constant 48 : i32; - v8 = arith.sub v6, v7 : i32 #[overflow = wrapping]; - v9 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v10 = hir.bitcast v9 : ptr; - hir.store v10, v8; - v12 = arith.constant 8 : u32; - v11 = hir.bitcast v0 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - 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; + private builtin.function @__rustc::__rust_dealloc(v0: i32, v1: i32, v2: i32) { + ^block4(v0: i32, v1: i32, v2: i32): + builtin.ret ; + }; + + 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; - v18 = hir.bitcast v0 : u32; - v20 = arith.add v18, v343 : u32 #[overflow = checked]; + v21 = hir.bitcast v3 : u32; + v23 = arith.add v21, v343 : u32 #[overflow = checked]; v342 = arith.constant 4 : u32; - v22 = arith.mod v20, v342 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - v24 = hir.load v23 : i32; + v25 = arith.mod v23, v342 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i32; v327 = arith.constant 2 : u32; - v26 = hir.bitcast v24 : u32; - v28 = arith.shr v26, v327 : u32; - v29 = hir.bitcast v28 : i32; - v30 = arith.constant 3 : i32; - v31 = arith.band v29, v30 : i32; - v32 = hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::from_u32(v31) : felt - v2 = arith.constant 0 : i32; - v34 = hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::from_u32(v2) : felt - hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::assert_eq(v32, v34) + v29 = hir.bitcast v27 : u32; + v31 = arith.shr v29, v327 : 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; - v36 = arith.band v17, v341 : i32; - v38 = arith.eq v36, v340 : i1; - v39 = arith.zext v38 : u32; - v40 = hir.bitcast v39 : i32; - v42 = arith.neq v40, v339 : i1; - scf.if v42{ - ^block7: - v46 = arith.constant 16 : i32; - v47 = arith.add v8, v46 : i32 #[overflow = wrapping]; - v45 = arith.add v29, v17 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/std::crypto::hashes::rpo::hash_memory_words(v29, v45, v47) + 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{ + ^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) scf.yield ; } else { - ^block8: + ^block10: v338 = arith.constant 16 : i32; - v44 = arith.add v8, v338 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/std::crypto::hashes::rpo::hash_memory(v29, v17, v44) + 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) scf.yield ; }; - v50 = arith.constant 24 : u32; - v49 = hir.bitcast v8 : u32; - v51 = arith.add v49, v50 : u32 #[overflow = checked]; + v53 = arith.constant 24 : u32; + v52 = hir.bitcast v11 : u32; + v54 = arith.add v52, v53 : u32 #[overflow = checked]; v337 = arith.constant 8 : u32; - v53 = arith.mod v51, v337 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - v55 = hir.load v54 : i64; - v57 = arith.constant 40 : u32; - v56 = hir.bitcast v8 : u32; - v58 = arith.add v56, v57 : u32 #[overflow = checked]; + 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; - v60 = arith.mod v58, v336 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - hir.store v61, v55; - v63 = arith.constant 16 : u32; - v62 = hir.bitcast v8 : u32; - v64 = arith.add v62, v63 : u32 #[overflow = checked]; + 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; - v66 = arith.mod v64, v335 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - v68 = hir.load v67 : i64; - v70 = arith.constant 32 : u32; - v69 = hir.bitcast v8 : u32; - v71 = arith.add v69, v70 : u32 #[overflow = checked]; + 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; - v73 = arith.mod v71, v334 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - hir.store v74, v68; - v75 = arith.constant 32 : i32; - v76 = arith.add v8, v75 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/miden_stdlib_sys::intrinsics::word::Word::reverse(v8, v76) - v78 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/hash_elements/alloc::raw_vec::RawVecInner::deallocate(v0, v78, v78) - v80 = hir.bitcast v8 : 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; - v82 = arith.mod v80, v333 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : felt; + 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; - v86 = arith.add v8, v332 : i32 #[overflow = wrapping]; - v87 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v88 = hir.bitcast v87 : ptr; - hir.store v88, v86; - builtin.ret v84; - }; - - private builtin.function @__rustc::__rust_dealloc(v89: i32, v90: i32, v91: i32) { - ^block9(v89: i32, v90: i32, v91: i32): - builtin.ret ; + 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; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v92: i32, v93: i32) { + 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; @@ -241,16 +241,16 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v181: i32) -> felt { - ^block17(v181: i32): - v182 = hir.bitcast v181 : felt; - builtin.ret v182; + private builtin.function @intrinsics::felt::assert_eq(v181: felt, v182: felt) { + ^block17(v181: felt, v182: felt): + hir.assert_eq v181, v182; + builtin.ret ; }; - private builtin.function @intrinsics::felt::assert_eq(v184: felt, v185: felt) { - ^block19(v184: felt, v185: felt): - hir.assert_eq v184, v185; - 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) { @@ -295,7 +295,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v222: i32, v223: i32, v224: i32) { + 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; @@ -307,7 +307,7 @@ builtin.component root_ns:root@1.0.0 { 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/alloc::raw_vec::RawVecInner::current_memory(v234, v222, v223, v224) + 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]; @@ -354,7 +354,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v267: i32, v268: i32, v269: i32, v270: i32) { + 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; diff --git a/tests/integration/expected/hash_elements.masm b/tests/integration/expected/hash_elements.masm index d4c26eadd..79abe2ac1 100644 --- a/tests/integration/expected/hash_elements.masm +++ b/tests/integration/expected/hash_elements.masm @@ -12,6 +12,13 @@ end # mod root_ns:root@1.0.0::hash_elements +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + @callconv("C") pub proc entrypoint(i32) -> felt push.1114112 @@ -203,7 +210,7 @@ pub proc entrypoint(i32) -> felt dup.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::root_ns:root@1.0.0::hash_elements::::reverse trace.252 nop push.4 @@ -212,7 +219,7 @@ pub proc entrypoint(i32) -> felt swap.3 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::alloc::raw_vec::RawVecInner::deallocate + exec.::root_ns:root@1.0.0::hash_elements::::deallocate trace.252 nop dup.0 @@ -243,14 +250,7 @@ pub proc entrypoint(i32) -> felt end @callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -527,13 +527,13 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") @@ -649,7 +649,7 @@ proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) end @callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +proc ::deallocate( i32, i32, i32 @@ -684,7 +684,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::alloc::raw_vec::RawVecInner::current_memory + exec.::root_ns:root@1.0.0::hash_elements::::current_memory trace.252 nop push.8 @@ -766,7 +766,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( +proc ::current_memory( i32, i32, i32, diff --git a/tests/integration/expected/hash_elements.wat b/tests/integration/expected/hash_elements.wat index 6b6a876ce..094889413 100644 --- a/tests/integration/expected/hash_elements.wat +++ b/tests/integration/expected/hash_elements.wat @@ -1,6 +1,6 @@ (module $hash_elements.wasm - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param i32 i32 i32))) + (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))) @@ -9,7 +9,8 @@ (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;0;) (type 0) (param i32) (result f32) + (func $__rustc::__rust_dealloc (;0;) (type 0) (param i32 i32 i32)) + (func $entrypoint (;1;) (type 1) (param i32) (result f32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 48 @@ -66,11 +67,11 @@ local.get 1 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 0 i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 1 f32.load local.set 4 @@ -80,8 +81,7 @@ global.set $__stack_pointer local.get 4 ) - (func $__rustc::__rust_dealloc (;1;) (type 1) (param i32 i32 i32)) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;2;) (type 2) (param i32 i32) + (func $::reverse (;2;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -139,19 +139,19 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;3;) (type 0) (param i32) (result f32) + (func $intrinsics::felt::assert_eq (;3;) (type 3) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;4;) (type 3) (param f32 f32) + (func $intrinsics::felt::from_u32 (;4;) (type 1) (param i32) (result f32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory (;5;) (type 1) (param i32 i32 i32) + (func $std::crypto::hashes::rpo::hash_memory (;5;) (type 0) (param i32 i32 i32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory_words (;6;) (type 1) (param i32 i32 i32) + (func $std::crypto::hashes::rpo::hash_memory_words (;6;) (type 0) (param i32 i32 i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;7;) (type 1) (param i32 i32 i32) + (func $::deallocate (;7;) (type 0) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -164,7 +164,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -183,7 +183,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::current_memory (;8;) (type 4) (param i32 i32 i32 i32) + (func $::current_memory (;8;) (type 4) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -218,7 +218,7 @@ local.get 4 i32.store ) - (func $::deallocate (;9;) (type 1) (param i32 i32 i32) + (func $::deallocate (;9;) (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 a7364e0d4..52f69ede5 100644 --- a/tests/integration/expected/hash_words.hir +++ b/tests/integration/expected/hash_words.hir @@ -1,103 +1,103 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @hash_words { - public builtin.function @entrypoint(v0: i32) -> felt { - ^block4(v0: i32): - v4 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v5 = hir.bitcast v4 : ptr; - v6 = hir.load v5 : i32; - v7 = arith.constant 48 : i32; - v8 = arith.sub v6, v7 : i32 #[overflow = wrapping]; - v9 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v10 = hir.bitcast v9 : ptr; - hir.store v10, v8; - v12 = arith.constant 4 : u32; - v11 = hir.bitcast v0 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; + private builtin.function @__rustc::__rust_dealloc(v0: i32, v1: i32, v2: i32) { + ^block4(v0: i32, v1: i32, v2: i32): + builtin.ret ; + }; + + 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; - v15 = arith.mod v13, v311 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i32; - v19 = arith.constant 8 : u32; - v18 = hir.bitcast v0 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; + 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; - v22 = arith.mod v20, v310 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - v24 = hir.load v23 : i32; - v2 = arith.constant 0 : i32; - v26 = hir.exec @root_ns:root@1.0.0/hash_words/intrinsics::felt::from_u32(v2) : felt + v25 = arith.mod v23, v310 : 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; - v28 = 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(v26, v28) + 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; - v30 = hir.bitcast v17 : u32; - v32 = arith.shr v30, v300 : u32; - v33 = hir.bitcast v32 : i32; - v38 = arith.constant 16 : i32; - v39 = arith.add v8, v38 : i32 #[overflow = wrapping]; + 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; - v36 = arith.shl v24, v308 : i32; - v37 = arith.add v33, v36 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_words/std::crypto::hashes::rpo::hash_memory_words(v33, v37, v39) - v41 = arith.constant 24 : u32; - v40 = hir.bitcast v8 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; + 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; - v44 = arith.mod v42, v307 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : i64; - v48 = arith.constant 40 : u32; - v47 = hir.bitcast v8 : u32; - v49 = arith.add v47, v48 : u32 #[overflow = checked]; + 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; - v51 = arith.mod v49, v306 : 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 v8 : u32; - v55 = arith.add v53, v54 : u32 #[overflow = checked]; + 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; - v57 = arith.mod v55, v305 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i64; - v61 = arith.constant 32 : u32; - v60 = hir.bitcast v8 : u32; - v62 = arith.add v60, v61 : u32 #[overflow = checked]; + 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; - v64 = arith.mod v62, v304 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v59; - v66 = arith.constant 32 : i32; - v67 = arith.add v8, v66 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_words/miden_stdlib_sys::intrinsics::word::Word::reverse(v8, v67) - v68 = hir.bitcast v8 : 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; - v70 = arith.mod v68, v303 : u32; - hir.assertz v70 #[code = 250]; - v71 = hir.int_to_ptr v68 : ptr; - v72 = hir.load v71 : felt; + 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/alloc::raw_vec::RawVecInner::deallocate(v0, v302, v302) + hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v3, v302, v302) v301 = arith.constant 48 : i32; - v76 = arith.add v8, v301 : i32 #[overflow = wrapping]; - v77 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v78 = hir.bitcast v77 : ptr; - hir.store v78, v76; - builtin.ret v72; - }; - - private builtin.function @__rustc::__rust_dealloc(v79: i32, v80: i32, v81: i32) { - ^block6(v79: i32, v80: i32, v81: i32): - builtin.ret ; + 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; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v82: i32, v83: i32) { + 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; @@ -224,16 +224,16 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v171: i32) -> felt { - ^block14(v171: i32): - v172 = hir.bitcast v171 : felt; - builtin.ret v172; + 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::assert_eq(v174: felt, v175: felt) { - ^block16(v174: felt, v175: felt): - hir.assert_eq v174, v175; - 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) { @@ -257,7 +257,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v194: i32, v195: i32, v196: i32) { + 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; @@ -269,7 +269,7 @@ builtin.component root_ns:root@1.0.0 { 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/alloc::raw_vec::RawVecInner::current_memory(v206, v194, v195, v196) + 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]; @@ -316,7 +316,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v239: i32, v240: i32, v241: i32, v242: i32) { + 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; diff --git a/tests/integration/expected/hash_words.masm b/tests/integration/expected/hash_words.masm index 4ded1fe80..00cfe9024 100644 --- a/tests/integration/expected/hash_words.masm +++ b/tests/integration/expected/hash_words.masm @@ -12,6 +12,13 @@ end # mod root_ns:root@1.0.0::hash_words +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + @callconv("C") pub proc entrypoint(i32) -> felt push.1114112 @@ -185,7 +192,7 @@ pub proc entrypoint(i32) -> felt dup.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::root_ns:root@1.0.0::hash_words::::reverse trace.252 nop dup.0 @@ -208,7 +215,7 @@ pub proc entrypoint(i32) -> felt swap.4 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::alloc::raw_vec::RawVecInner::deallocate + exec.::root_ns:root@1.0.0::hash_words::::deallocate trace.252 nop push.48 @@ -224,14 +231,7 @@ pub proc entrypoint(i32) -> felt end @callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -508,13 +508,13 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") @@ -574,7 +574,7 @@ proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) end @callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +proc ::deallocate( i32, i32, i32 @@ -609,7 +609,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::alloc::raw_vec::RawVecInner::current_memory + exec.::root_ns:root@1.0.0::hash_words::::current_memory trace.252 nop push.8 @@ -691,7 +691,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( +proc ::current_memory( i32, i32, i32, diff --git a/tests/integration/expected/hash_words.wat b/tests/integration/expected/hash_words.wat index f4b411bf3..8829a42e4 100644 --- a/tests/integration/expected/hash_words.wat +++ b/tests/integration/expected/hash_words.wat @@ -1,6 +1,6 @@ (module $hash_words.wasm - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param i32 i32 i32))) + (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))) @@ -9,7 +9,8 @@ (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;0;) (type 0) (param i32) (result f32) + (func $__rustc::__rust_dealloc (;0;) (type 0) (param i32 i32 i32)) + (func $entrypoint (;1;) (type 1) (param i32) (result f32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 48 @@ -52,22 +53,21 @@ local.get 1 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 f32.load local.set 4 local.get 0 i32.const 16 i32.const 16 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 1 i32.const 48 i32.add global.set $__stack_pointer local.get 4 ) - (func $__rustc::__rust_dealloc (;1;) (type 1) (param i32 i32 i32)) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;2;) (type 2) (param i32 i32) + (func $::reverse (;2;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -125,16 +125,16 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;3;) (type 0) (param i32) (result f32) + (func $intrinsics::felt::assert_eq (;3;) (type 3) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;4;) (type 3) (param f32 f32) + (func $intrinsics::felt::from_u32 (;4;) (type 1) (param i32) (result f32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory_words (;5;) (type 1) (param i32 i32 i32) + (func $std::crypto::hashes::rpo::hash_memory_words (;5;) (type 0) (param i32 i32 i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;6;) (type 1) (param i32 i32 i32) + (func $::deallocate (;6;) (type 0) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -147,7 +147,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -166,7 +166,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::current_memory (;7;) (type 4) (param i32 i32 i32 i32) + (func $::current_memory (;7;) (type 4) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -201,7 +201,7 @@ local.get 4 i32.store ) - (func $::deallocate (;8;) (type 1) (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/mem_intrinsics_heap_base.hir b/tests/integration/expected/mem_intrinsics_heap_base.hir index c82e30528..1d3a89ec6 100644 --- a/tests/integration/expected/mem_intrinsics_heap_base.hir +++ b/tests/integration/expected/mem_intrinsics_heap_base.hir @@ -1,60 +1,60 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @mem_intrinsics_heap_base { - public builtin.function @entrypoint(v0: i32, v1: i32) { + 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; + }; + + public builtin.function @entrypoint(v5: i32, v6: i32) { + ^block6(v5: i32, v6: i32): hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v3 = arith.constant 4 : i32; - v5 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/__rustc::__rust_alloc(v3, v3) : i32 - v2 = arith.constant 0 : i32; - v7 = arith.neq v5, v2 : i1; - cf.cond_br v7 ^block6, ^block7; - ^block6: - v12 = arith.constant 8 : u32; - v11 = hir.bitcast v0 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 4 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v10 = arith.constant 1 : i32; - v16 = hir.int_to_ptr v13 : ptr; - hir.store v16, v10; + 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; + ^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; - v17 = hir.bitcast v0 : u32; - v19 = arith.add v17, v142 : u32 #[overflow = checked]; + v22 = hir.bitcast v5 : u32; + v24 = arith.add v22, v142 : u32 #[overflow = checked]; v141 = arith.constant 4 : u32; - v21 = arith.mod v19, v141 : u32; - hir.assertz v21 #[code = 250]; - v22 = hir.int_to_ptr v19 : ptr; - hir.store v22, v5; - v24 = hir.bitcast v0 : u32; - v140 = arith.constant 4 : u32; - v26 = arith.mod v24, v140 : u32; + v26 = arith.mod v24, v141 : u32; hir.assertz v26 #[code = 250]; - v139 = arith.constant 1 : i32; v27 = hir.int_to_ptr v24 : ptr; - hir.store v27, v139; - v31 = hir.bitcast v5 : u32; + 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; - v33 = arith.mod v31, v138 : u32; - hir.assertz v33 #[code = 250]; + v38 = arith.mod v36, v138 : u32; + hir.assertz v38 #[code = 250]; v135 = arith.constant 1 : u32; - v30 = arith.shl v1, v135 : i32; - v34 = hir.int_to_ptr v31 : ptr; - hir.store v34, v30; + v35 = arith.shl v6, v135 : i32; + v39 = hir.int_to_ptr v36 : ptr; + hir.store v39, v35; builtin.ret ; - ^block7: + ^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) ub.unreachable ; }; - private builtin.function @__rustc::__rust_alloc(v35: i32, v36: i32) -> i32 { - ^block8(v35: i32, v36: i32): - v38 = arith.constant 1048576 : i32; - v39 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/::alloc(v38, v36, v35) : i32 - builtin.ret v39; - }; - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { ^block10: builtin.ret ; @@ -83,7 +83,7 @@ builtin.component root_ns:root@1.0.0 { scf.yield v149, v145; } else { ^block15: - v61 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/core::ptr::alignment::Alignment::max(v41, v54) : i32 + 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]; @@ -190,7 +190,7 @@ builtin.component root_ns:root@1.0.0 { ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v124: i32, v125: i32) -> i32 { + private builtin.function @::max(v124: i32, v125: i32) -> i32 { ^block27(v124: i32, v125: i32): v132 = arith.constant 0 : i32; v128 = hir.bitcast v125 : u32; diff --git a/tests/integration/expected/mem_intrinsics_heap_base.wat b/tests/integration/expected/mem_intrinsics_heap_base.wat index 42eac0aa2..2dd846705 100644 --- a/tests/integration/expected/mem_intrinsics_heap_base.wat +++ b/tests/integration/expected/mem_intrinsics_heap_base.wat @@ -1,6 +1,6 @@ (module $mem_intrinsics_heap_base.wasm - (type (;0;) (func (param i32 i32))) - (type (;1;) (func (param i32 i32) (result i32))) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32 i32))) (type (;2;) (func)) (type (;3;) (func (param i32 i32 i32) (result i32))) (type (;4;) (func (result i32))) @@ -9,7 +9,13 @@ (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;0;) (type 0) (param i32 i32) + (func $__rustc::__rust_alloc (;0;) (type 0) (param i32 i32) (result i32) + i32.const 1048576 + local.get 1 + local.get 0 + call $::alloc + ) + (func $entrypoint (;1;) (type 1) (param i32 i32) (local i32) call $__rustc::__rust_no_alloc_shim_is_unstable_v2 block ;; label = @1 @@ -38,12 +44,6 @@ i32.shl i32.store ) - (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) - i32.const 1048576 - local.get 1 - local.get 0 - call $::alloc - ) (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;2;) (type 2) return ) @@ -66,7 +66,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -122,10 +122,10 @@ (func $intrinsics::mem::heap_base (;4;) (type 4) (result i32) unreachable ) - (func $alloc::alloc::handle_alloc_error (;5;) (type 0) (param i32 i32) + (func $alloc::alloc::handle_alloc_error (;5;) (type 1) (param i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;6;) (type 1) (param i32 i32) (result i32) + (func $::max (;6;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/tests/integration/expected/rust_sdk/component_macros_account.wat b/tests/integration/expected/rust_sdk/component_macros_account.wat index 647ca1304..be40331a3 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.wat +++ b/tests/integration/expected/rust_sdk/component_macros_account.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result i32))) (table (;0;) 2 2 funcref) @@ -77,28 +77,28 @@ (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") ) - (alias export 0 "asset" (type (;1;))) - (alias export 0 "felt" (type (;2;))) - (alias export 0 "word" (type (;3;))) + (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;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;3;))) (type (;4;) (variant (case "variant-a") (case "variant-b"))) - (type (;5;) (record (field "value" 2))) + (type (;5;) (record (field "value" $felt))) (type (;6;) (record (field "nested" 5))) - (type (;7;) (record (field "foo" 3) (field "asset" 1))) - (type (;8;) (record (field "bar" 2) (field "baz" 2))) - (type (;9;) (record (field "inner1" 2) (field "inner2" 2))) - (type (;10;) (record (field "bar" 2) (field "baz" 2))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;11;) (func (param "a" 7) (param "asset" 1) (result 8))) - (alias core export 0 "miden:component-macros-account/component-macros-account@0.1.0#test-custom-types" (core func (;0;))) - (func (;0;) (type 11) (canon lift (core func 0) (memory 0))) - (type (;12;) (func (param "a" 7) (param "asset" 1) (result 9))) - (alias core export 0 "miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2" (core func (;1;))) - (func (;1;) (type 12) (canon lift (core func 1) (memory 0))) - (alias export 0 "felt" (type (;13;))) - (alias export 0 "word" (type (;14;))) - (alias export 0 "asset" (type (;15;))) - (component (;0;) + (type (;7;) (record (field "foo" $word) (field "asset" $asset))) + (type (;8;) (record (field "bar" $felt) (field "baz" $felt))) + (type (;9;) (record (field "inner1" $felt) (field "inner2" $felt))) + (type (;10;) (record (field "bar" $felt) (field "baz" $felt))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;11;) (func (param "a" 7) (param "asset" $asset) (result 8))) + (alias core export $main "miden:component-macros-account/component-macros-account@0.1.0#test-custom-types" (core func $miden:component-macros-account/component-macros-account@0.1.0#test-custom-types (;0;))) + (func $test-custom-types (;0;) (type 11) (canon lift (core func $miden:component-macros-account/component-macros-account@0.1.0#test-custom-types) (memory $memory))) + (type (;12;) (func (param "a" 7) (param "asset" $asset) (result 9))) + (alias core export $main "miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2" (core func $miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2 (;1;))) + (func $test-custom-types2 (;1;) (type 12) (canon lift (core func $miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type13 felt" (@name "felt") (;13;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type14 word" (@name "word") (;14;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type15 asset" (@name "asset") (;15;))) + (component $miden:component-macros-account/component-macros-account@0.1.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -141,19 +141,19 @@ (type (;36;) (func (param "a" 28) (param "asset" 18) (result 32))) (export (;3;) "test-custom-types2" (func 1) (func (type 36))) ) - (instance (;1;) (instantiate 0 - (with "import-func-test-custom-types" (func 0)) - (with "import-func-test-custom-types2" (func 1)) - (with "import-type-felt" (type 13)) - (with "import-type-word" (type 14)) - (with "import-type-asset" (type 15)) - (with "import-type-word0" (type 3)) - (with "import-type-asset0" (type 1)) + (instance $miden:component-macros-account/component-macros-account@0.1.0-shim-instance (;1;) (instantiate $miden:component-macros-account/component-macros-account@0.1.0-shim-component + (with "import-func-test-custom-types" (func $test-custom-types)) + (with "import-func-test-custom-types2" (func $test-custom-types2)) + (with "import-type-felt" (type $"#type13 felt")) + (with "import-type-word" (type $"#type14 word")) + (with "import-type-asset" (type $"#type15 asset")) + (with "import-type-word0" (type $word)) + (with "import-type-asset0" (type $asset)) (with "import-type-struct-a" (type 7)) - (with "import-type-felt0" (type 2)) + (with "import-type-felt0" (type $felt)) (with "import-type-struct-b" (type 8)) (with "import-type-struct-c" (type 9)) ) ) - (export (;2;) "miden:component-macros-account/component-macros-account@0.1.0" (instance 1)) + (export $miden:component-macros-account/component-macros-account@0.1.0 (;2;) "miden:component-macros-account/component-macros-account@0.1.0" (instance $miden:component-macros-account/component-macros-account@0.1.0-shim-instance)) ) diff --git a/tests/integration/expected/rust_sdk/component_macros_note.hir b/tests/integration/expected/rust_sdk/component_macros_note.hir index 2963c370d..1f4bacdfa 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.hir +++ b/tests/integration/expected/rust_sdk/component_macros_note.hir @@ -163,16 +163,16 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v118: i32) -> felt { - ^block21(v118: i32): - v119 = hir.bitcast v118 : felt; - builtin.ret v119; + 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::eq(v121: felt, v122: felt) -> i32 { - ^block23(v121: felt, v122: felt): - v123 = arith.eq v121, v122 : i1; - v124 = hir.cast v123 : i32; + private builtin.function @intrinsics::felt::from_u32(v123: i32) -> felt { + ^block23(v123: i32): + v124 = hir.bitcast v123 : felt; builtin.ret v124; }; diff --git a/tests/integration/expected/rust_sdk/component_macros_note.masm b/tests/integration/expected/rust_sdk/component_macros_note.masm index 48ea894ea..633f975a0 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.masm +++ b/tests/integration/expected/rust_sdk/component_macros_note.masm @@ -391,12 +391,12 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::eq(felt, felt) -> i32 + eq end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq +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 c6923add8..fc5a23a16 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.wat +++ b/tests/integration/expected/rust_sdk/component_macros_note.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,19 +10,19 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (alias export 0 "word" (type (;1;))) - (alias export 0 "asset" (type (;2;))) - (alias export 0 "felt" (type (;3;))) - (type (;4;) + (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))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;2;))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (type $ty-miden:component-macros-account/component-macros-account@0.1.0 (;4;) (instance - (alias outer 1 1 (type (;0;))) + (alias outer 1 $word (type (;0;))) (export (;1;) "word" (type (eq 0))) - (alias outer 1 2 (type (;2;))) + (alias outer 1 $asset (type (;2;))) (export (;3;) "asset" (type (eq 2))) (type (;4;) (record (field "foo" 1) (field "asset" 3))) (export (;5;) "struct-a" (type (eq 4))) - (alias outer 1 3 (type (;6;))) + (alias outer 1 $felt (type (;6;))) (export (;7;) "felt" (type (eq 6))) (type (;8;) (record (field "bar" 7) (field "baz" 7))) (export (;9;) "struct-b" (type (eq 8))) @@ -30,13 +30,13 @@ (export (;0;) "test-custom-types" (func (type 10))) ) ) - (import "miden:component-macros-account/component-macros-account@0.1.0" (instance (;1;) (type 4))) - (core module (;0;) + (import "miden:component-macros-account/component-macros-account@0.1.0" (instance $miden:component-macros-account/component-macros-account@0.1.0 (;1;) (type $ty-miden:component-macros-account/component-macros-account@0.1.0))) + (core module $main (;0;) (type (;0;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (type (;1;) (func)) (type (;2;) (func (param f32 f32 f32 f32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param f32 f32) (result i32))) + (type (;4;) (func (param i32) (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) @@ -141,20 +141,20 @@ i32.store8 end ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;6;) (type 4) (param f32 f32) (result i32) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) - (core module (;1;) + (core module $wit-component-shim-module (;1;) (type (;0;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 1 1 funcref) - (export "0" (func $indirect-miden:component-macros-account/component-macros-account@0.1.0-test-custom-types)) + (export "0" (func 0)) (export "$imports" (table 0)) - (func $indirect-miden:component-macros-account/component-macros-account@0.1.0-test-custom-types (;0;) (type 0) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func (;0;) (type 0) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) local.get 0 local.get 1 local.get 2 @@ -172,40 +172,40 @@ call_indirect (type 0) ) ) - (core module (;2;) + (core module $wit-component-fixup (;2;) (type (;0;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (import "" "0" (func (;0;) (type 0))) (import "" "$imports" (table (;0;) 1 1 funcref)) (elem (;0;) (i32.const 0) func 0) ) - (core instance (;0;) (instantiate 1)) - (alias export 0 "word" (type (;5;))) - (alias core export 0 "0" (core func (;0;))) - (core instance (;1;) - (export "test-custom-types" (func 0)) + (core instance $wit-component-shim-instance (;0;) (instantiate $wit-component-shim-module)) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type5 word" (@name "word") (;5;))) + (alias core export $wit-component-shim-instance "0" (core func $indirect-miden:component-macros-account/component-macros-account@0.1.0-test-custom-types (;0;))) + (core instance $miden:component-macros-account/component-macros-account@0.1.0 (;1;) + (export "test-custom-types" (func $indirect-miden:component-macros-account/component-macros-account@0.1.0-test-custom-types)) ) - (core instance (;2;) (instantiate 0 - (with "miden:component-macros-account/component-macros-account@0.1.0" (instance 1)) + (core instance $main (;2;) (instantiate $main + (with "miden:component-macros-account/component-macros-account@0.1.0" (instance $miden:component-macros-account/component-macros-account@0.1.0)) ) ) - (alias core export 2 "memory" (core memory (;0;))) - (alias core export 0 "$imports" (core table (;0;))) - (alias export 1 "test-custom-types" (func (;0;))) - (core func (;1;) (canon lower (func 0) (memory 0))) - (core instance (;3;) - (export "$imports" (table 0)) - (export "0" (func 1)) + (alias core export $main "memory" (core memory $memory (;0;))) + (alias core export $wit-component-shim-instance "$imports" (core table $"shim table" (;0;))) + (alias export $miden:component-macros-account/component-macros-account@0.1.0 "test-custom-types" (func $test-custom-types (;0;))) + (core func $"#core-func1 indirect-miden:component-macros-account/component-macros-account@0.1.0-test-custom-types" (@name "indirect-miden:component-macros-account/component-macros-account@0.1.0-test-custom-types") (;1;) (canon lower (func $test-custom-types) (memory $memory))) + (core instance $fixup-args (;3;) + (export "$imports" (table $"shim table")) + (export "0" (func $"#core-func1 indirect-miden:component-macros-account/component-macros-account@0.1.0-test-custom-types")) ) - (core instance (;4;) (instantiate 2 - (with "" (instance 3)) + (core instance $fixup (;4;) (instantiate $wit-component-fixup + (with "" (instance $fixup-args)) ) ) - (type (;6;) (func (param "arg" 5))) - (alias core export 2 "miden:base/note-script@1.0.0#run" (core func (;2;))) - (func (;1;) (type 6) (canon lift (core func 2))) - (alias export 0 "felt" (type (;7;))) - (alias export 0 "word" (type (;8;))) - (component (;0;) + (type (;6;) (func (param "arg" $"#type5 word"))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;2;))) + (func $run (;1;) (type 6) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type7 felt" (@name "felt") (;7;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type8 word" (@name "word") (;8;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -218,12 +218,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;2;) (instantiate 0 - (with "import-func-run" (func 1)) - (with "import-type-felt" (type 7)) - (with "import-type-word" (type 8)) - (with "import-type-word0" (type 5)) + (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $"#type7 felt")) + (with "import-type-word" (type $"#type8 word")) + (with "import-type-word0" (type $"#type5 word")) ) ) - (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) + (export $miden:base/note-script@1.0.0 (;3;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.hir b/tests/integration/expected/rust_sdk/cross_ctx_account.hir index 5b2db79f1..6a5ea7266 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.hir @@ -78,15 +78,15 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { builtin.ret v47; }; - private builtin.function @intrinsics::felt::from_u32(v49: i32) -> felt { - ^block17(v49: i32): - v50 = hir.bitcast v49 : felt; + 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::as_u64(v52: felt) -> i64 { - ^block19(v52: felt): - v53 = hir.cast v52 : i64; + private builtin.function @intrinsics::felt::from_u32(v52: i32) -> felt { + ^block19(v52: i32): + v53 = hir.bitcast v52 : felt; builtin.ret v53; }; diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.masm b/tests/integration/expected/rust_sdk/cross_ctx_account.masm index e5154ae82..ec2620d40 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.masm @@ -195,12 +195,12 @@ proc intrinsics::felt::add(felt, felt) -> felt end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::as_u64(felt) -> [u32; 2] + u32split end @callconv("C") -proc intrinsics::felt::as_u64(felt) -> [u32; 2] - u32split +proc intrinsics::felt::from_u32(i32) -> felt + nop end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.wat b/tests/integration/expected/rust_sdk/cross_ctx_account.wat index 89af0be24..4baffb323 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.wat @@ -1,17 +1,17 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 (param f32) (result f32))) (type (;2;) (func (param f32 f32) (result f32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32) (result i64))) + (type (;3;) (func (param f32) (result i64))) + (type (;4;) (func (param i32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -60,22 +60,22 @@ (func $intrinsics::felt::add (;4;) (type 2) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::as_u64 (;5;) (type 3) (param f32) (result i64) unreachable ) - (func $intrinsics::felt::as_u64 (;6;) (type 4) (param f32) (result i64) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00*\00\00\00") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "input" 1) (result 1))) - (alias core export 0 "miden:cross-ctx-account/foo@1.0.0#process-felt" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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 (param "input" $felt) (result $felt))) + (alias core export $main "miden:cross-ctx-account/foo@1.0.0#process-felt" (core func $miden:cross-ctx-account/foo@1.0.0#process-felt (;0;))) + (func $process-felt (;0;) (type 2) (canon lift (core func $miden:cross-ctx-account/foo@1.0.0#process-felt))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type3 felt" (@name "felt") (;3;))) + (component $miden:cross-ctx-account/foo@1.0.0-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))) @@ -85,11 +85,11 @@ (type (;5;) (func (param "input" 4) (result 4))) (export (;1;) "process-felt" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-process-felt" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:cross-ctx-account/foo@1.0.0-shim-instance (;1;) (instantiate $miden:cross-ctx-account/foo@1.0.0-shim-component + (with "import-func-process-felt" (func $process-felt)) + (with "import-type-felt" (type $"#type3 felt")) + (with "import-type-felt0" (type $felt)) ) ) - (export (;2;) "miden:cross-ctx-account/foo@1.0.0" (instance 1)) + (export $miden:cross-ctx-account/foo@1.0.0 (;2;) "miden:cross-ctx-account/foo@1.0.0" (instance $miden:cross-ctx-account/foo@1.0.0-shim-instance)) ) 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 d16d78076..ea5ed2692 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir @@ -10,24 +10,24 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { builtin.ret ; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-word(v0: felt, v1: felt, v2: felt, v3: felt) -> i32 { + 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.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 1 : i32; + 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 2 : i32; + 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 3 : i32; + 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 4 : i32; + 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; @@ -63,266 +63,266 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { builtin.ret v19; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-another-word(v45: felt, v46: felt, v47: felt, v48: felt) -> i32 { - ^block11(v45: felt, v46: felt, v47: felt, v48: felt): - v51 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v52 = hir.bitcast v51 : ptr; - v53 = hir.load v52 : i32; + private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-felt(v45: felt) -> felt { + ^block11(v45: felt): hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v54 = arith.constant 2 : i32; - v55 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v54) : felt - v56 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v45, v55) : felt - v57 = arith.constant 3 : i32; - v58 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v57) : felt - v59 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v46, v58) : felt - v60 = arith.constant 4 : i32; - v61 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v60) : felt - v62 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v47, v61) : felt - v63 = arith.constant 1048584 : i32; - v64 = arith.add v53, v63 : i32 #[overflow = wrapping]; - v65 = arith.constant 5 : i32; + 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; + }; + + 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; + 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(v48, v66) : felt - v69 = arith.constant 12 : u32; - v68 = hir.bitcast v64 : 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; - hir.store v73, v67; - v75 = arith.constant 8 : u32; - v74 = hir.bitcast v64 : u32; + 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]; - v491 = arith.constant 4 : u32; - v78 = arith.mod v76, v491 : u32; + v77 = arith.constant 2 : u32; + v78 = arith.mod v76, v77 : u32; hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - hir.store v79, v62; + 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; - v80 = hir.bitcast v64 : u32; - v82 = arith.add v80, v490 : u32 #[overflow = checked]; + 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; - v84 = arith.mod v82, v489 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - hir.store v85, v59; - v86 = hir.bitcast v64 : u32; - v488 = arith.constant 4 : u32; - v88 = arith.mod v86, v488 : u32; - hir.assertz v88 #[code = 250]; - v89 = hir.int_to_ptr v86 : ptr; - hir.store v89, v56; - builtin.ret v64; - }; - - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-felt(v90: felt) -> felt { - ^block13(v90: felt): - hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v92 = arith.constant 3 : i32; - v93 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v92) : felt - v94 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v90, v93) : felt - builtin.ret v94; + 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; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-pair(v95: felt, v96: felt) -> i32 { - ^block15(v95: felt, v96: felt): - v99 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v100 = hir.bitcast v99 : ptr; - v101 = hir.load v100 : i32; + 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; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v102 = arith.constant 4 : i32; - v103 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v102) : felt - v104 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v95, v103) : felt - v105 = arith.constant 1048584 : i32; - v106 = arith.add v101, v105 : i32 #[overflow = wrapping]; - v494 = arith.constant 4 : i32; - v108 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v494) : felt - v109 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v96, v108) : felt - v111 = arith.constant 4 : u32; - v110 = hir.bitcast v106 : u32; - v112 = arith.add v110, v111 : u32 #[overflow = checked]; + 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; - v114 = arith.mod v112, v493 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - hir.store v115, v109; - v116 = hir.bitcast v106 : u32; + v151 = hir.bitcast v141 : u32; + v153 = arith.add v151, v493 : u32 #[overflow = checked]; v492 = arith.constant 4 : u32; - v118 = arith.mod v116, v492 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - hir.store v119, v104; - builtin.ret v106; + 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-triple(v120: felt, v121: felt, v122: felt) -> i32 { - ^block17(v120: felt, v121: felt, v122: felt): - v125 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v126 = hir.bitcast v125 : ptr; - v127 = hir.load v126 : i32; + 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() - v128 = arith.constant 5 : i32; - v129 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v128) : felt - v130 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v120, v129) : felt - v499 = arith.constant 5 : i32; - v132 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v499) : felt - v133 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v121, v132) : felt - v134 = arith.constant 1048584 : i32; - v135 = arith.add v127, v134 : i32 #[overflow = wrapping]; - v498 = arith.constant 5 : i32; - v137 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v498) : felt - v138 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v122, v137) : felt - v140 = arith.constant 8 : u32; - v139 = hir.bitcast v135 : 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; + 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; - v145 = hir.bitcast v135 : u32; - v147 = arith.add v145, v497 : u32 #[overflow = checked]; + v180 = arith.mod v178, v497 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v175; + v182 = hir.bitcast v172 : u32; v496 = arith.constant 4 : u32; - v149 = arith.mod v147, v496 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v133; - v151 = hir.bitcast v135 : u32; - v495 = arith.constant 4 : u32; - v153 = arith.mod v151, v495 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v130; - builtin.ret v135; + 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; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-mixed(v155: i64, v156: felt, v157: i32, v158: felt, v159: i32, v160: i32, v161: i32) -> i32 { - ^block19(v155: i64, v156: felt, v157: i32, v158: felt, v159: i32, v160: i32, v161: i32): - v164 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v165 = hir.bitcast v164 : ptr; - v166 = hir.load v165 : i32; + 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; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v167 = arith.constant 6 : i32; - v168 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v167) : felt - v169 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v156, v168) : felt - v170 = arith.constant 7 : i32; - v171 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v170) : felt - v172 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v158, v171) : felt - v173 = arith.constant 1048584 : i32; - v174 = arith.add v166, v173 : i32 #[overflow = wrapping]; - v180 = arith.constant 22 : u32; - v179 = hir.bitcast v174 : u32; - v181 = arith.add v179, v180 : u32 #[overflow = checked]; - v182 = arith.constant 2 : u32; - v183 = arith.mod v181, v182 : u32; - hir.assertz v183 #[code = 250]; - v175 = arith.constant 9 : i32; - v176 = arith.add v161, v175 : i32 #[overflow = wrapping]; - v177 = hir.bitcast v176 : u32; - v178 = arith.trunc v177 : u16; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v163 = arith.constant 0 : i32; - v185 = arith.constant 255 : i32; - v186 = arith.band v160, v185 : i32; - v188 = arith.eq v186, v163 : i1; - v189 = arith.zext v188 : u32; - v190 = hir.bitcast v189 : i32; - v191 = hir.bitcast v190 : u32; - v192 = arith.trunc v191 : u8; - v194 = arith.constant 21 : u32; - v193 = hir.bitcast v174 : u32; - v195 = arith.add v193, v194 : u32 #[overflow = checked]; - v196 = hir.int_to_ptr v195 : ptr; - hir.store v196, v192; - v197 = arith.constant 11 : i32; - v198 = arith.add v159, v197 : i32 #[overflow = wrapping]; - v199 = hir.bitcast v198 : u32; - v200 = arith.trunc v199 : u8; - v202 = arith.constant 20 : u32; - v201 = hir.bitcast v174 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v204 = hir.int_to_ptr v203 : ptr; - hir.store v204, v200; - v206 = arith.constant 16 : u32; - v205 = hir.bitcast v174 : u32; + 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, v172; - v214 = arith.constant 12 : u32; - v213 = hir.bitcast v174 : u32; - v215 = arith.add v213, v214 : u32 #[overflow = checked]; - v502 = arith.constant 4 : u32; - v217 = arith.mod v215, v502 : u32; - hir.assertz v217 #[code = 250]; - v211 = arith.constant 10 : i32; - v212 = arith.add v157, v211 : i32 #[overflow = wrapping]; - v218 = hir.int_to_ptr v215 : ptr; - hir.store v218, v212; - v220 = arith.constant 8 : u32; - v219 = hir.bitcast v174 : u32; - v221 = arith.add v219, v220 : u32 #[overflow = checked]; + hir.store v210, v204; v501 = arith.constant 4 : u32; - v223 = arith.mod v221, v501 : u32; - hir.assertz v223 #[code = 250]; - v224 = hir.int_to_ptr v221 : ptr; - hir.store v224, v169; - v227 = hir.bitcast v174 : u32; - v500 = arith.constant 8 : u32; - v229 = arith.mod v227, v500 : u32; - hir.assertz v229 #[code = 250]; - v225 = arith.constant 1000 : i64; - v226 = arith.add v155, v225 : i64 #[overflow = wrapping]; - v230 = hir.int_to_ptr v227 : ptr; - hir.store v230, v226; - builtin.ret v174; + 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; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-nested(v231: felt, v232: felt, v233: felt) -> i32 { - ^block21(v231: felt, v232: felt, v233: felt): - v236 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v237 = hir.bitcast v236 : ptr; - v238 = hir.load v237 : i32; + 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; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v239 = arith.constant 8 : i32; - v240 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v239) : felt - v241 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v231, v240) : felt - v507 = arith.constant 8 : i32; - v243 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v507) : felt - v244 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v232, v243) : felt - v245 = arith.constant 1048584 : i32; - v246 = arith.add v238, v245 : i32 #[overflow = wrapping]; - v506 = arith.constant 8 : i32; - v248 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v506) : felt - v249 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v233, v248) : felt + 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 v246 : u32; + v250 = hir.bitcast v240 : u32; v252 = arith.add v250, v251 : u32 #[overflow = checked]; - v253 = arith.constant 4 : u32; - v254 = arith.mod v252, v253 : u32; + 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, v249; + 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; - v256 = hir.bitcast v246 : u32; - v258 = arith.add v256, v505 : u32 #[overflow = checked]; - v504 = arith.constant 4 : u32; - v260 = arith.mod v258, v504 : u32; + v260 = arith.mod v258, v505 : u32; hir.assertz v260 #[code = 250]; v261 = hir.int_to_ptr v258 : ptr; - hir.store v261, v244; - v262 = hir.bitcast v246 : u32; - v503 = arith.constant 4 : u32; - v264 = arith.mod v262, v503 : u32; + 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, v241; - builtin.ret v246; + hir.store v265, v232; + builtin.ret v240; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { 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 4cffebed0..da08823d4 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm @@ -436,7 +436,7 @@ proc cross_ctx_account_word::bindings::__link_custom_section_describing_imports( end @callconv("C") -proc miden:cross-ctx-account-word/foo@1.0.0#process-word( +proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( felt, felt, felt, @@ -455,7 +455,7 @@ proc 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::wit_bindgen::rt::run_ctors_once trace.252 nop - push.1 + push.2 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -467,7 +467,7 @@ proc 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::intrinsics::felt::add trace.252 nop - push.2 + push.3 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -479,7 +479,7 @@ proc 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::intrinsics::felt::add trace.252 nop - push.3 + push.4 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -494,7 +494,7 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( push.1048584 movup.4 u32wrapping_add - push.4 + push.5 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -580,50 +580,50 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( end @callconv("C") -proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( - felt, - felt, - felt, - felt -) -> i32 - push.1114148 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop +proc miden:cross-ctx-account-word/foo@1.0.0#process-felt(felt) -> felt 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 - push.2 + push.3 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - movup.2 + swap.1 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add trace.252 nop - push.3 +end + +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( + [u32; 2], + felt, + i32, + felt, + i32, + i32, + i32 +) -> i32 + push.1114148 + u32divmod.4 + 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::load_sw trace.252 nop - movup.3 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once trace.252 nop - push.4 + push.6 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -635,39 +635,121 @@ proc 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::intrinsics::felt::add trace.252 nop - push.1048584 - movup.4 - u32wrapping_add - push.5 + push.7 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - movup.5 + movup.6 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add trace.252 nop - push.12 - dup.2 + push.1048584 + movup.3 + u32wrapping_add + push.22 + dup.1 add u32assert - push.4 + push.2 dup.1 swap.1 u32mod u32assert assertz + push.9 + movup.10 + u32wrapping_add + push.65535 + u32and + swap.1 u32divmod.4 swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.65535 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + push.0 + push.255 + movup.9 + u32and + eq + push.255 + u32and + push.21 + dup.2 + add + u32assert + 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 + push.11 + movup.7 + u32wrapping_add + push.255 + u32and + push.20 + dup.2 + add + u32assert + 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 + push.16 dup.1 add u32assert @@ -686,7 +768,7 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( exec.::intrinsics::mem::store_felt trace.252 nop - push.4 + push.12 dup.1 add u32assert @@ -696,16 +778,21 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32mod u32assert assertz - movup.2 + push.10 + movup.6 + u32wrapping_add swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 + push.8 + dup.1 + add + u32assert push.4 dup.1 swap.1 @@ -721,31 +808,40 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( exec.::intrinsics::mem::store_felt trace.252 nop -end - -@callconv("C") -proc miden:cross-ctx-account-word/foo@1.0.0#process-felt(felt) -> felt - 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 - push.3 + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1000 + push.0 + movup.5 + movup.5 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::std::math::u64::wrapping_add trace.252 nop + movup.2 + u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::store_dw trace.252 nop end @callconv("C") -proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 +proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( + felt, + felt, + felt +) -> i32 push.1114148 u32divmod.4 swap.1 @@ -759,7 +855,7 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once trace.252 nop - push.4 + push.8 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -771,22 +867,34 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add trace.252 nop + push.8 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop push.1048584 - movup.2 + movup.3 u32wrapping_add - push.4 + push.8 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - movup.3 + movup.4 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add trace.252 nop - push.4 + push.8 dup.2 add u32assert @@ -803,6 +911,25 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 exec.::intrinsics::mem::store_felt trace.252 nop + push.4 + dup.1 + 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_felt + trace.252 + nop dup.0 push.4 dup.1 @@ -822,11 +949,7 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 end @callconv("C") -proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( - felt, - felt, - felt -) -> i32 +proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 push.1114148 u32divmod.4 swap.1 @@ -840,7 +963,7 @@ proc 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::wit_bindgen::rt::run_ctors_once trace.252 nop - push.5 + push.4 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -852,52 +975,23 @@ proc 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::intrinsics::felt::add trace.252 nop - push.5 - trace.240 - nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 - trace.252 - nop - movup.3 - trace.240 - nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add - trace.252 - nop push.1048584 - movup.3 + movup.2 u32wrapping_add - push.5 + push.4 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - movup.4 + movup.3 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add trace.252 nop - 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::store_felt - trace.252 - nop push.4 - dup.1 + dup.2 add u32assert push.4 @@ -906,8 +1000,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 @@ -934,14 +1026,10 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( end @callconv("C") -proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( - [u32; 2], +proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( felt, - i32, felt, - i32, - i32, - i32 + felt ) -> i32 push.1114148 u32divmod.4 @@ -956,25 +1044,25 @@ proc 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::wit_bindgen::rt::run_ctors_once trace.252 nop - push.6 + push.5 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - movup.4 + movup.2 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add trace.252 nop - push.7 + push.5 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - movup.6 + movup.3 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add @@ -983,126 +1071,20 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( push.1048584 movup.3 u32wrapping_add - push.22 - dup.1 - add - u32assert - push.2 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.9 - movup.10 - u32wrapping_add - push.65535 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.65535 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - push.0 - push.255 - movup.9 - u32and - eq - push.255 - u32and - push.21 - dup.2 - add - u32assert - 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 - push.11 - movup.7 - u32wrapping_add - push.255 - u32and - push.20 - dup.2 - add - u32assert - 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 - push.16 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 + push.5 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - push.12 - dup.1 + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.8 + dup.2 add u32assert push.4 @@ -1111,18 +1093,14 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32mod u32assert assertz - push.10 - movup.6 - u32wrapping_add - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::store_felt trace.252 nop - push.8 + push.4 dup.1 add u32assert @@ -1142,35 +1120,26 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( trace.252 nop dup.0 - push.8 + push.4 dup.1 swap.1 u32mod u32assert assertz - push.1000 - push.0 - movup.5 - movup.5 - trace.240 - nop - exec.::std::math::u64::wrapping_add - trace.252 - nop 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 miden:cross-ctx-account-word/foo@1.0.0#process-nested( +proc miden:cross-ctx-account-word/foo@1.0.0#process-word( + felt, felt, felt, felt @@ -1188,7 +1157,7 @@ proc 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::wit_bindgen::rt::run_ctors_once trace.252 nop - push.8 + push.1 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -1200,7 +1169,7 @@ proc 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::intrinsics::felt::add trace.252 nop - push.8 + push.2 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 @@ -1212,22 +1181,34 @@ proc 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::intrinsics::felt::add 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 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop push.1048584 - movup.3 + movup.4 u32wrapping_add - push.8 + push.4 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 trace.252 nop - movup.4 + movup.5 trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add trace.252 nop - push.8 + push.12 dup.2 add u32assert @@ -1244,6 +1225,25 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( exec.::intrinsics::mem::store_felt trace.252 nop + push.8 + dup.1 + 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_felt + trace.252 + nop push.4 dup.1 add diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat b/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat index fad410705..2f67b1789 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,14 +8,14 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32) (result i32))) (type (;2;) (func (param f32) (result f32))) - (type (;3;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param i64 f32 i32 f32 i32 i32 i32) (result i32))) (type (;4;) (func (param f32 f32 f32) (result i32))) - (type (;5;) (func (param i64 f32 i32 f32 i32 i32 i32) (result i32))) + (type (;5;) (func (param f32 f32) (result i32))) (type (;6;) (func (param f32 f32) (result f32))) (type (;7;) (func (param i32) (result f32))) (table (;0;) 2 2 funcref) @@ -23,33 +23,33 @@ (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:cross-ctx-account-word/foo@1.0.0#process-word" (func $miden:cross-ctx-account-word/foo@1.0.0#process-word)) (export "miden:cross-ctx-account-word/foo@1.0.0#process-another-word" (func $miden:cross-ctx-account-word/foo@1.0.0#process-another-word)) (export "miden:cross-ctx-account-word/foo@1.0.0#process-felt" (func $miden:cross-ctx-account-word/foo@1.0.0#process-felt)) - (export "miden:cross-ctx-account-word/foo@1.0.0#process-pair" (func $miden:cross-ctx-account-word/foo@1.0.0#process-pair)) - (export "miden:cross-ctx-account-word/foo@1.0.0#process-triple" (func $miden:cross-ctx-account-word/foo@1.0.0#process-triple)) (export "miden:cross-ctx-account-word/foo@1.0.0#process-mixed" (func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed)) (export "miden:cross-ctx-account-word/foo@1.0.0#process-nested" (func $miden:cross-ctx-account-word/foo@1.0.0#process-nested)) + (export "miden:cross-ctx-account-word/foo@1.0.0#process-pair" (func $miden:cross-ctx-account-word/foo@1.0.0#process-pair)) + (export "miden:cross-ctx-account-word/foo@1.0.0#process-triple" (func $miden:cross-ctx-account-word/foo@1.0.0#process-triple)) + (export "miden:cross-ctx-account-word/foo@1.0.0#process-word" (func $miden:cross-ctx-account-word/foo@1.0.0#process-word)) (elem (;0;) (i32.const 1) func $cross_ctx_account_word::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $cross_ctx_account_word::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-word (;2;) (type 1) (param f32 f32 f32 f32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-another-word (;2;) (type 1) (param f32 f32 f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 4 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 1 + i32.const 2 call $intrinsics::felt::from_u32 call $intrinsics::felt::add local.set 0 local.get 1 - i32.const 2 + i32.const 3 call $intrinsics::felt::from_u32 call $intrinsics::felt::add local.set 1 local.get 2 - i32.const 3 + i32.const 4 call $intrinsics::felt::from_u32 call $intrinsics::felt::add local.set 2 @@ -58,7 +58,7 @@ i32.add local.tee 4 local.get 3 - i32.const 4 + i32.const 5 call $intrinsics::felt::from_u32 call $intrinsics::felt::add f32.store offset=12 @@ -73,54 +73,98 @@ f32.store local.get 4 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-another-word (;3;) (type 1) (param f32 f32 f32 f32) (result i32) - (local i32) - global.get $GOT.data.internal.__memory_base - local.set 4 + (func $miden:cross-ctx-account-word/foo@1.0.0#process-felt (;3;) (type 2) (param f32) (result f32) call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 2 + i32.const 3 call $intrinsics::felt::from_u32 call $intrinsics::felt::add - local.set 0 + ) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed (;4;) (type 3) (param i64 f32 i32 f32 i32 i32 i32) (result i32) + (local i32) + global.get $GOT.data.internal.__memory_base + local.set 7 + call $wit_bindgen::rt::run_ctors_once local.get 1 - i32.const 3 + i32.const 6 call $intrinsics::felt::from_u32 call $intrinsics::felt::add local.set 1 - local.get 2 - i32.const 4 + local.get 3 + i32.const 7 call $intrinsics::felt::from_u32 call $intrinsics::felt::add - local.set 2 - local.get 4 + local.set 3 + local.get 7 i32.const 1048584 i32.add - local.tee 4 - local.get 3 - i32.const 5 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::add - f32.store offset=12 + local.tee 7 + local.get 6 + i32.const 9 + i32.add + i32.store16 offset=22 + local.get 7 + local.get 5 + i32.const 255 + i32.and + i32.eqz + i32.store8 offset=21 + local.get 7 local.get 4 + i32.const 11 + i32.add + i32.store8 offset=20 + local.get 7 + local.get 3 + f32.store offset=16 + local.get 7 local.get 2 - f32.store offset=8 - local.get 4 + i32.const 10 + i32.add + i32.store offset=12 + local.get 7 local.get 1 - f32.store offset=4 - local.get 4 + f32.store offset=8 + local.get 7 local.get 0 - f32.store - local.get 4 + i64.const 1000 + i64.add + i64.store + local.get 7 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-felt (;4;) (type 2) (param f32) (result f32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-nested (;5;) (type 4) (param f32 f32 f32) (result i32) + (local i32) + global.get $GOT.data.internal.__memory_base + local.set 3 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 3 + i32.const 8 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add + local.set 0 + local.get 1 + i32.const 8 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add + local.set 1 + local.get 3 + i32.const 1048584 + i32.add + local.tee 3 + local.get 2 + i32.const 8 call $intrinsics::felt::from_u32 call $intrinsics::felt::add + f32.store offset=8 + local.get 3 + local.get 1 + f32.store offset=4 + local.get 3 + local.get 0 + f32.store + local.get 3 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-pair (;5;) (type 3) (param f32 f32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-pair (;6;) (type 5) (param f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 2 @@ -144,7 +188,7 @@ f32.store local.get 2 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-triple (;6;) (type 4) (param f32 f32 f32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-triple (;7;) (type 4) (param f32 f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 3 @@ -176,89 +220,45 @@ f32.store local.get 3 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed (;7;) (type 5) (param i64 f32 i32 f32 i32 i32 i32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-word (;8;) (type 1) (param f32 f32 f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base - local.set 7 - call $wit_bindgen::rt::run_ctors_once - local.get 1 - i32.const 6 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::add - local.set 1 - local.get 3 - i32.const 7 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::add - local.set 3 - local.get 7 - i32.const 1048584 - i32.add - local.tee 7 - local.get 6 - i32.const 9 - i32.add - i32.store16 offset=22 - local.get 7 - local.get 5 - i32.const 255 - i32.and - i32.eqz - i32.store8 offset=21 - local.get 7 - local.get 4 - i32.const 11 - i32.add - i32.store8 offset=20 - local.get 7 - local.get 3 - f32.store offset=16 - local.get 7 - local.get 2 - i32.const 10 - i32.add - i32.store offset=12 - local.get 7 - local.get 1 - f32.store offset=8 - local.get 7 - local.get 0 - i64.const 1000 - i64.add - i64.store - local.get 7 - ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-nested (;8;) (type 4) (param f32 f32 f32) (result i32) - (local i32) - global.get $GOT.data.internal.__memory_base - local.set 3 + local.set 4 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 8 + i32.const 1 call $intrinsics::felt::from_u32 call $intrinsics::felt::add local.set 0 local.get 1 - i32.const 8 + i32.const 2 call $intrinsics::felt::from_u32 call $intrinsics::felt::add local.set 1 - local.get 3 + local.get 2 + i32.const 3 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add + local.set 2 + local.get 4 i32.const 1048584 i32.add - local.tee 3 - local.get 2 - i32.const 8 + local.tee 4 + local.get 3 + i32.const 4 call $intrinsics::felt::from_u32 call $intrinsics::felt::add + f32.store offset=12 + local.get 4 + local.get 2 f32.store offset=8 - local.get 3 + local.get 4 local.get 1 f32.store offset=4 - local.get 3 + local.get 4 local.get 0 f32.store - local.get 3 + local.get 4 ) (func $wit_bindgen::rt::run_ctors_once (;9;) (type 0) (local i32) @@ -286,37 +286,37 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (alias export 0 "felt" (type (;2;))) - (type (;3;) (record (field "first" 2) (field "second" 2))) - (type (;4;) (record (field "x" 2) (field "y" 2) (field "z" 2))) - (type (;5;) (record (field "f" u64) (field "a" 2) (field "b" u32) (field "c" 2) (field "d" u8) (field "e" bool) (field "g" u16))) - (type (;6;) (record (field "inner" 3) (field "value" 2))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;7;) (func (param "input" 1) (result 1))) - (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-word" (core func (;0;))) - (func (;0;) (type 7) (canon lift (core func 0) (memory 0))) - (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-another-word" (core func (;1;))) - (func (;1;) (type 7) (canon lift (core func 1) (memory 0))) - (type (;8;) (func (param "input" 2) (result 2))) - (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-felt" (core func (;2;))) - (func (;2;) (type 8) (canon lift (core func 2))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;2;))) + (type (;3;) (record (field "first" $felt) (field "second" $felt))) + (type (;4;) (record (field "x" $felt) (field "y" $felt) (field "z" $felt))) + (type (;5;) (record (field "f" u64) (field "a" $felt) (field "b" u32) (field "c" $felt) (field "d" u8) (field "e" bool) (field "g" u16))) + (type (;6;) (record (field "inner" 3) (field "value" $felt))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;7;) (func (param "input" $word) (result $word))) + (alias core export $main "miden:cross-ctx-account-word/foo@1.0.0#process-word" (core func $miden:cross-ctx-account-word/foo@1.0.0#process-word (;0;))) + (func $process-word (;0;) (type 7) (canon lift (core func $miden:cross-ctx-account-word/foo@1.0.0#process-word) (memory $memory))) + (alias core export $main "miden:cross-ctx-account-word/foo@1.0.0#process-another-word" (core func $miden:cross-ctx-account-word/foo@1.0.0#process-another-word (;1;))) + (func $process-another-word (;1;) (type 7) (canon lift (core func $miden:cross-ctx-account-word/foo@1.0.0#process-another-word) (memory $memory))) + (type (;8;) (func (param "input" $felt) (result $felt))) + (alias core export $main "miden:cross-ctx-account-word/foo@1.0.0#process-felt" (core func $miden:cross-ctx-account-word/foo@1.0.0#process-felt (;2;))) + (func $process-felt (;2;) (type 8) (canon lift (core func $miden:cross-ctx-account-word/foo@1.0.0#process-felt))) (type (;9;) (func (param "input" 3) (result 3))) - (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-pair" (core func (;3;))) - (func (;3;) (type 9) (canon lift (core func 3) (memory 0))) + (alias core export $main "miden:cross-ctx-account-word/foo@1.0.0#process-pair" (core func $miden:cross-ctx-account-word/foo@1.0.0#process-pair (;3;))) + (func $process-pair (;3;) (type 9) (canon lift (core func $miden:cross-ctx-account-word/foo@1.0.0#process-pair) (memory $memory))) (type (;10;) (func (param "input" 4) (result 4))) - (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-triple" (core func (;4;))) - (func (;4;) (type 10) (canon lift (core func 4) (memory 0))) + (alias core export $main "miden:cross-ctx-account-word/foo@1.0.0#process-triple" (core func $miden:cross-ctx-account-word/foo@1.0.0#process-triple (;4;))) + (func $process-triple (;4;) (type 10) (canon lift (core func $miden:cross-ctx-account-word/foo@1.0.0#process-triple) (memory $memory))) (type (;11;) (func (param "input" 5) (result 5))) - (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-mixed" (core func (;5;))) - (func (;5;) (type 11) (canon lift (core func 5) (memory 0))) + (alias core export $main "miden:cross-ctx-account-word/foo@1.0.0#process-mixed" (core func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed (;5;))) + (func $process-mixed (;5;) (type 11) (canon lift (core func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed) (memory $memory))) (type (;12;) (func (param "input" 6) (result 6))) - (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-nested" (core func (;6;))) - (func (;6;) (type 12) (canon lift (core func 6) (memory 0))) - (alias export 0 "felt" (type (;13;))) - (alias export 0 "word" (type (;14;))) - (component (;0;) + (alias core export $main "miden:cross-ctx-account-word/foo@1.0.0#process-nested" (core func $miden:cross-ctx-account-word/foo@1.0.0#process-nested (;6;))) + (func $process-nested (;6;) (type 12) (canon lift (core func $miden:cross-ctx-account-word/foo@1.0.0#process-nested) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type13 felt" (@name "felt") (;13;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type14 word" (@name "word") (;14;))) + (component $miden:cross-ctx-account-word/foo@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -369,23 +369,23 @@ (type (;36;) (func (param "input" 30) (result 30))) (export (;13;) "process-nested" (func 6) (func (type 36))) ) - (instance (;1;) (instantiate 0 - (with "import-func-process-word" (func 0)) - (with "import-func-process-another-word" (func 1)) - (with "import-func-process-felt" (func 2)) - (with "import-func-process-pair" (func 3)) - (with "import-func-process-triple" (func 4)) - (with "import-func-process-mixed" (func 5)) - (with "import-func-process-nested" (func 6)) - (with "import-type-felt" (type 13)) - (with "import-type-word" (type 14)) - (with "import-type-word0" (type 1)) - (with "import-type-felt0" (type 2)) + (instance $miden:cross-ctx-account-word/foo@1.0.0-shim-instance (;1;) (instantiate $miden:cross-ctx-account-word/foo@1.0.0-shim-component + (with "import-func-process-word" (func $process-word)) + (with "import-func-process-another-word" (func $process-another-word)) + (with "import-func-process-felt" (func $process-felt)) + (with "import-func-process-pair" (func $process-pair)) + (with "import-func-process-triple" (func $process-triple)) + (with "import-func-process-mixed" (func $process-mixed)) + (with "import-func-process-nested" (func $process-nested)) + (with "import-type-felt" (type $"#type13 felt")) + (with "import-type-word" (type $"#type14 word")) + (with "import-type-word0" (type $word)) + (with "import-type-felt0" (type $felt)) (with "import-type-pair" (type 3)) (with "import-type-triple" (type 4)) (with "import-type-mixed-struct" (type 5)) (with "import-type-nested-struct" (type 6)) ) ) - (export (;2;) "miden:cross-ctx-account-word/foo@1.0.0" (instance 1)) + (export $miden:cross-ctx-account-word/foo@1.0.0 (;2;) "miden:cross-ctx-account-word/foo@1.0.0" (instance $miden:cross-ctx-account-word/foo@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat index 42fc578e0..297ba0a3a 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) (type (;2;) (func (param f32 f32) (result f32))) @@ -139,16 +139,16 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (alias export 0 "felt" (type (;2;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;3;) (func (param "input1" 1) (param "input2" 1) (param "input3" 1) (param "felt1" 2) (param "felt2" 2) (param "felt3" 2) (param "felt4" 2) (result 2))) - (alias core export 0 "miden:cross-ctx-account-word-arg/foo@1.0.0#process-word" (core func (;0;))) - (func (;0;) (type 3) (canon lift (core func 0))) - (alias export 0 "felt" (type (;4;))) - (alias export 0 "word" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;2;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;3;) (func (param "input1" $word) (param "input2" $word) (param "input3" $word) (param "felt1" $felt) (param "felt2" $felt) (param "felt3" $felt) (param "felt4" $felt) (result $felt))) + (alias core export $main "miden:cross-ctx-account-word-arg/foo@1.0.0#process-word" (core func $miden:cross-ctx-account-word-arg/foo@1.0.0#process-word (;0;))) + (func $process-word (;0;) (type 3) (canon lift (core func $miden:cross-ctx-account-word-arg/foo@1.0.0#process-word))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type4 felt" (@name "felt") (;4;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type5 word" (@name "word") (;5;))) + (component $miden:cross-ctx-account-word-arg/foo@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -163,13 +163,13 @@ (type (;10;) (func (param "input1" 8) (param "input2" 8) (param "input3" 8) (param "felt1" 9) (param "felt2" 9) (param "felt3" 9) (param "felt4" 9) (result 9))) (export (;1;) "process-word" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-process-word" (func 0)) - (with "import-type-felt" (type 4)) - (with "import-type-word" (type 5)) - (with "import-type-word0" (type 1)) - (with "import-type-felt0" (type 2)) + (instance $miden:cross-ctx-account-word-arg/foo@1.0.0-shim-instance (;1;) (instantiate $miden:cross-ctx-account-word-arg/foo@1.0.0-shim-component + (with "import-func-process-word" (func $process-word)) + (with "import-type-felt" (type $"#type4 felt")) + (with "import-type-word" (type $"#type5 word")) + (with "import-type-word0" (type $word)) + (with "import-type-felt0" (type $felt)) ) ) - (export (;2;) "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance 1)) + (export $miden:cross-ctx-account-word-arg/foo@1.0.0 (;2;) "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance $miden:cross-ctx-account-word-arg/foo@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.hir b/tests/integration/expected/rust_sdk/cross_ctx_note.hir index 701fc0154..b41016ea6 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.hir @@ -84,22 +84,22 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v54: i32) -> felt { - ^block18(v54: i32): - v55 = hir.bitcast v54 : felt; + 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::as_u64(v57: felt) -> i64 { - ^block20(v57: felt): - v58 = hir.cast v57 : i64; - builtin.ret v58; + 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::assert_eq(v60: felt, v61: felt) { - ^block22(v60: felt, v61: felt): - hir.assert_eq v60, v61; - 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 { diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.masm b/tests/integration/expected/rust_sdk/cross_ctx_note.masm index 4cc1e9f6e..abeb22f22 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.masm @@ -226,11 +226,6 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - @callconv("C") proc intrinsics::felt::as_u64(felt) -> [u32; 2] u32split @@ -241,3 +236,8 @@ 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.wat b/tests/integration/expected/rust_sdk/cross_ctx_note.wat index 5cbf1d9db..714e1470c 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,24 +8,24 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (alias export 0 "felt" (type (;1;))) - (type (;2;) + (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))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) + (type $ty-miden:cross-ctx-account/foo@1.0.0 (;2;) (instance - (alias outer 1 1 (type (;0;))) + (alias outer 1 $felt (type (;0;))) (export (;1;) "felt" (type (eq 0))) (type (;2;) (func (param "input" 1) (result 1))) (export (;0;) "process-felt" (func (type 2))) ) ) - (import "miden:cross-ctx-account/foo@1.0.0" (instance (;1;) (type 2))) - (core module (;0;) + (import "miden:cross-ctx-account/foo@1.0.0" (instance $miden:cross-ctx-account/foo@1.0.0 (;1;) (type $ty-miden:cross-ctx-account/foo@1.0.0))) + (core module $main (;0;) (type (;0;) (func (param f32) (result f32))) (type (;1;) (func)) (type (;2;) (func (param f32 f32 f32 f32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32) (result i64))) - (type (;5;) (func (param f32 f32))) + (type (;3;) (func (param f32) (result i64))) + (type (;4;) (func (param f32 f32))) + (type (;5;) (func (param i32) (result f32))) (import "miden:cross-ctx-account/foo@1.0.0" "process-felt" (func $cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -80,34 +80,34 @@ i32.store8 end ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::as_u64 (;5;) (type 3) (param f32) (result i64) unreachable ) - (func $intrinsics::felt::as_u64 (;6;) (type 4) (param f32) (result i64) + (func $intrinsics::felt::assert_eq (;6;) (type 4) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;7;) (type 5) (param f32 f32) + (func $intrinsics::felt::from_u32 (;7;) (type 5) (param i32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\0b\00\00\00") ) - (alias export 0 "word" (type (;3;))) - (alias export 1 "process-felt" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (core instance (;0;) - (export "process-felt" (func 0)) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;3;))) + (alias export $miden:cross-ctx-account/foo@1.0.0 "process-felt" (func $process-felt (;0;))) + (core func $process-felt (;0;) (canon lower (func $process-felt))) + (core instance $miden:cross-ctx-account/foo@1.0.0 (;0;) + (export "process-felt" (func $process-felt)) ) - (core instance (;1;) (instantiate 0 - (with "miden:cross-ctx-account/foo@1.0.0" (instance 0)) + (core instance $main (;1;) (instantiate $main + (with "miden:cross-ctx-account/foo@1.0.0" (instance $miden:cross-ctx-account/foo@1.0.0)) ) ) - (alias core export 1 "memory" (core memory (;0;))) - (type (;4;) (func (param "arg" 3))) - (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;1;))) - (func (;1;) (type 4) (canon lift (core func 1))) - (alias export 0 "felt" (type (;5;))) - (alias export 0 "word" (type (;6;))) - (component (;0;) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;4;) (func (param "arg" $word))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;1;))) + (func $run (;1;) (type 4) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type5 felt" (@name "felt") (;5;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type6 word" (@name "word") (;6;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -120,12 +120,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;2;) (instantiate 0 - (with "import-func-run" (func 1)) - (with "import-type-felt" (type 5)) - (with "import-type-word" (type 6)) - (with "import-type-word0" (type 3)) + (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $"#type5 felt")) + (with "import-type-word" (type $"#type6 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) + (export $miden:base/note-script@1.0.0 (;3;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) 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 631ba28c0..ab8b42c4d 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir @@ -602,22 +602,22 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v503; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v504: i64) -> felt { - ^block38(v504: i64): - v505 = hir.cast v504 : felt; - builtin.ret v505; + 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(v507: i32) -> felt { - ^block40(v507: i32): - v508 = hir.bitcast v507 : felt; - builtin.ret v508; + 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::assert_eq(v510: felt, v511: felt) { - ^block42(v510: felt, v511: felt): - hir.assert_eq v510, v511; - builtin.ret ; + private builtin.function @intrinsics::felt::from_u64_unchecked(v509: i64) -> felt { + ^block42(v509: i64): + v510 = hir.cast v509 : felt; + builtin.ret v510; }; builtin.global_variable private @#__stack_pointer : i32 { 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 0010b5ac0..9ae4fb781 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm @@ -1535,6 +1535,16 @@ proc >::from 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 @@ -1551,13 +1561,3 @@ proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt add end -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -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 fb82b6fd4..1cce65d7c 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,14 +8,14 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (alias export 0 "word" (type (;1;))) - (alias export 0 "felt" (type (;2;))) - (type (;3;) + (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))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;2;))) + (type $ty-miden:cross-ctx-account-word/foo@1.0.0 (;3;) (instance - (alias outer 1 1 (type (;0;))) + (alias outer 1 $word (type (;0;))) (export (;1;) "word" (type (eq 0))) - (alias outer 1 2 (type (;2;))) + (alias outer 1 $felt (type (;2;))) (export (;3;) "felt" (type (eq 2))) (type (;4;) (record (field "first" 3) (field "second" 3))) (export (;5;) "pair" (type (eq 4))) @@ -40,8 +40,8 @@ (export (;6;) "process-nested" (func (type 17))) ) ) - (import "miden:cross-ctx-account-word/foo@1.0.0" (instance (;1;) (type 3))) - (core module (;0;) + (import "miden:cross-ctx-account-word/foo@1.0.0" (instance $miden:cross-ctx-account-word/foo@1.0.0 (;1;) (type $ty-miden:cross-ctx-account-word/foo@1.0.0))) + (core module $main (;0;) (type (;0;) (func (param f32 f32 f32 f32 i32))) (type (;1;) (func (param f32) (result f32))) (type (;2;) (func (param f32 f32 i32))) @@ -50,8 +50,8 @@ (type (;5;) (func)) (type (;6;) (func (param f32 f32 f32 f32))) (type (;7;) (func (param i32) (result f32))) - (type (;8;) (func (param i64) (result f32))) - (type (;9;) (func (param f32 f32))) + (type (;8;) (func (param f32 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))) (import "miden:cross-ctx-account-word/foo@1.0.0" "process-felt" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 (;2;) (type 1))) @@ -351,31 +351,31 @@ i32.and f32.reinterpret_i32 ) - (func $intrinsics::felt::from_u64_unchecked (;14;) (type 8) (param i64) (result f32) + (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::assert_eq (;16;) (type 9) (param f32 f32) + (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 (;1;) + (core module $wit-component-shim-module (;1;) (type (;0;) (func (param f32 f32 f32 f32 i32))) (type (;1;) (func (param f32 f32 i32))) (type (;2;) (func (param f32 f32 f32 i32))) (type (;3;) (func (param i64 f32 i32 f32 i32 i32 i32 i32))) (table (;0;) 6 6 funcref) - (export "0" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-word)) - (export "1" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-another-word)) - (export "2" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-pair)) - (export "3" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-triple)) - (export "4" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-mixed)) - (export "5" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-nested)) + (export "0" (func 0)) + (export "1" (func 1)) + (export "2" (func 2)) + (export "3" (func 3)) + (export "4" (func 4)) + (export "5" (func 5)) (export "$imports" (table 0)) - (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-word (;0;) (type 0) (param f32 f32 f32 f32 i32) + (func (;0;) (type 0) (param f32 f32 f32 f32 i32) local.get 0 local.get 1 local.get 2 @@ -384,7 +384,7 @@ i32.const 0 call_indirect (type 0) ) - (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-another-word (;1;) (type 0) (param f32 f32 f32 f32 i32) + (func (;1;) (type 0) (param f32 f32 f32 f32 i32) local.get 0 local.get 1 local.get 2 @@ -393,14 +393,14 @@ i32.const 1 call_indirect (type 0) ) - (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-pair (;2;) (type 1) (param f32 f32 i32) + (func (;2;) (type 1) (param f32 f32 i32) local.get 0 local.get 1 local.get 2 i32.const 2 call_indirect (type 1) ) - (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-triple (;3;) (type 2) (param f32 f32 f32 i32) + (func (;3;) (type 2) (param f32 f32 f32 i32) local.get 0 local.get 1 local.get 2 @@ -408,7 +408,7 @@ i32.const 3 call_indirect (type 2) ) - (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-mixed (;4;) (type 3) (param i64 f32 i32 f32 i32 i32 i32 i32) + (func (;4;) (type 3) (param i64 f32 i32 f32 i32 i32 i32 i32) local.get 0 local.get 1 local.get 2 @@ -420,7 +420,7 @@ i32.const 4 call_indirect (type 3) ) - (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-nested (;5;) (type 2) (param f32 f32 f32 i32) + (func (;5;) (type 2) (param f32 f32 f32 i32) local.get 0 local.get 1 local.get 2 @@ -429,7 +429,7 @@ call_indirect (type 2) ) ) - (core module (;2;) + (core module $wit-component-fixup (;2;) (type (;0;) (func (param f32 f32 f32 f32 i32))) (type (;1;) (func (param f32 f32 i32))) (type (;2;) (func (param f32 f32 f32 i32))) @@ -443,62 +443,62 @@ (import "" "$imports" (table (;0;) 6 6 funcref)) (elem (;0;) (i32.const 0) func 0 1 2 3 4 5) ) - (core instance (;0;) (instantiate 1)) - (alias export 0 "word" (type (;4;))) - (alias core export 0 "0" (core func (;0;))) - (alias core export 0 "1" (core func (;1;))) - (alias export 1 "process-felt" (func (;0;))) - (core func (;2;) (canon lower (func 0))) - (alias core export 0 "2" (core func (;3;))) - (alias core export 0 "3" (core func (;4;))) - (alias core export 0 "4" (core func (;5;))) - (alias core export 0 "5" (core func (;6;))) - (core instance (;1;) - (export "process-word" (func 0)) - (export "process-another-word" (func 1)) - (export "process-felt" (func 2)) - (export "process-pair" (func 3)) - (export "process-triple" (func 4)) - (export "process-mixed" (func 5)) - (export "process-nested" (func 6)) + (core instance $wit-component-shim-instance (;0;) (instantiate $wit-component-shim-module)) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (alias core export $wit-component-shim-instance "0" (core func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-word (;0;))) + (alias core export $wit-component-shim-instance "1" (core func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-another-word (;1;))) + (alias export $miden:cross-ctx-account-word/foo@1.0.0 "process-felt" (func $process-felt (;0;))) + (core func $process-felt (;2;) (canon lower (func $process-felt))) + (alias core export $wit-component-shim-instance "2" (core func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-pair (;3;))) + (alias core export $wit-component-shim-instance "3" (core func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-triple (;4;))) + (alias core export $wit-component-shim-instance "4" (core func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-mixed (;5;))) + (alias core export $wit-component-shim-instance "5" (core func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-nested (;6;))) + (core instance $miden:cross-ctx-account-word/foo@1.0.0 (;1;) + (export "process-word" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-word)) + (export "process-another-word" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-another-word)) + (export "process-felt" (func $process-felt)) + (export "process-pair" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-pair)) + (export "process-triple" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-triple)) + (export "process-mixed" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-mixed)) + (export "process-nested" (func $indirect-miden:cross-ctx-account-word/foo@1.0.0-process-nested)) ) - (core instance (;2;) (instantiate 0 - (with "miden:cross-ctx-account-word/foo@1.0.0" (instance 1)) + (core instance $main (;2;) (instantiate $main + (with "miden:cross-ctx-account-word/foo@1.0.0" (instance $miden:cross-ctx-account-word/foo@1.0.0)) ) ) - (alias core export 2 "memory" (core memory (;0;))) - (alias core export 0 "$imports" (core table (;0;))) - (alias export 1 "process-word" (func (;1;))) - (core func (;7;) (canon lower (func 1) (memory 0))) - (alias export 1 "process-another-word" (func (;2;))) - (core func (;8;) (canon lower (func 2) (memory 0))) - (alias export 1 "process-pair" (func (;3;))) - (core func (;9;) (canon lower (func 3) (memory 0))) - (alias export 1 "process-triple" (func (;4;))) - (core func (;10;) (canon lower (func 4) (memory 0))) - (alias export 1 "process-mixed" (func (;5;))) - (core func (;11;) (canon lower (func 5) (memory 0))) - (alias export 1 "process-nested" (func (;6;))) - (core func (;12;) (canon lower (func 6) (memory 0))) - (core instance (;3;) - (export "$imports" (table 0)) - (export "0" (func 7)) - (export "1" (func 8)) - (export "2" (func 9)) - (export "3" (func 10)) - (export "4" (func 11)) - (export "5" (func 12)) + (alias core export $main "memory" (core memory $memory (;0;))) + (alias core export $wit-component-shim-instance "$imports" (core table $"shim table" (;0;))) + (alias export $miden:cross-ctx-account-word/foo@1.0.0 "process-word" (func $process-word (;1;))) + (core func $"#core-func7 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-word" (@name "indirect-miden:cross-ctx-account-word/foo@1.0.0-process-word") (;7;) (canon lower (func $process-word) (memory $memory))) + (alias export $miden:cross-ctx-account-word/foo@1.0.0 "process-another-word" (func $process-another-word (;2;))) + (core func $"#core-func8 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-another-word" (@name "indirect-miden:cross-ctx-account-word/foo@1.0.0-process-another-word") (;8;) (canon lower (func $process-another-word) (memory $memory))) + (alias export $miden:cross-ctx-account-word/foo@1.0.0 "process-pair" (func $process-pair (;3;))) + (core func $"#core-func9 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-pair" (@name "indirect-miden:cross-ctx-account-word/foo@1.0.0-process-pair") (;9;) (canon lower (func $process-pair) (memory $memory))) + (alias export $miden:cross-ctx-account-word/foo@1.0.0 "process-triple" (func $process-triple (;4;))) + (core func $"#core-func10 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-triple" (@name "indirect-miden:cross-ctx-account-word/foo@1.0.0-process-triple") (;10;) (canon lower (func $process-triple) (memory $memory))) + (alias export $miden:cross-ctx-account-word/foo@1.0.0 "process-mixed" (func $process-mixed (;5;))) + (core func $"#core-func11 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-mixed" (@name "indirect-miden:cross-ctx-account-word/foo@1.0.0-process-mixed") (;11;) (canon lower (func $process-mixed) (memory $memory))) + (alias export $miden:cross-ctx-account-word/foo@1.0.0 "process-nested" (func $process-nested (;6;))) + (core func $"#core-func12 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-nested" (@name "indirect-miden:cross-ctx-account-word/foo@1.0.0-process-nested") (;12;) (canon lower (func $process-nested) (memory $memory))) + (core instance $fixup-args (;3;) + (export "$imports" (table $"shim table")) + (export "0" (func $"#core-func7 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-word")) + (export "1" (func $"#core-func8 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-another-word")) + (export "2" (func $"#core-func9 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-pair")) + (export "3" (func $"#core-func10 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-triple")) + (export "4" (func $"#core-func11 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-mixed")) + (export "5" (func $"#core-func12 indirect-miden:cross-ctx-account-word/foo@1.0.0-process-nested")) ) - (core instance (;4;) (instantiate 2 - (with "" (instance 3)) + (core instance $fixup (;4;) (instantiate $wit-component-fixup + (with "" (instance $fixup-args)) ) ) - (type (;5;) (func (param "arg" 4))) - (alias core export 2 "miden:base/note-script@1.0.0#run" (core func (;13;))) - (func (;7;) (type 5) (canon lift (core func 13))) - (alias export 0 "felt" (type (;6;))) - (alias export 0 "word" (type (;7;))) - (component (;0;) + (type (;5;) (func (param "arg" $"#type4 word"))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;13;))) + (func $run (;7;) (type 5) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type6 felt" (@name "felt") (;6;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type7 word" (@name "word") (;7;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -511,12 +511,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;2;) (instantiate 0 - (with "import-func-run" (func 7)) - (with "import-type-felt" (type 6)) - (with "import-type-word" (type 7)) - (with "import-type-word0" (type 4)) + (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $"#type6 felt")) + (with "import-type-word" (type $"#type7 word")) + (with "import-type-word0" (type $"#type4 word")) ) ) - (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) + (export $miden:base/note-script@1.0.0 (;3;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) 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 ae4f5f5df..5b1c53eea 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 @@ -92,16 +92,16 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v79: i32) -> felt { - ^block18(v79: i32): - v80 = hir.bitcast v79 : felt; - builtin.ret v80; + 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::assert_eq(v82: felt, v83: felt) { - ^block20(v82: felt, v83: felt): - hir.assert_eq v82, v83; - 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 { 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 1857a734d..984ad994e 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 @@ -297,12 +297,12 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat index 545f5c7e7..695773839 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,26 +8,26 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (alias export 0 "word" (type (;1;))) - (alias export 0 "felt" (type (;2;))) - (type (;3;) + (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))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;2;))) + (type $ty-miden:cross-ctx-account-word-arg/foo@1.0.0 (;3;) (instance - (alias outer 1 1 (type (;0;))) + (alias outer 1 $word (type (;0;))) (export (;1;) "word" (type (eq 0))) - (alias outer 1 2 (type (;2;))) + (alias outer 1 $felt (type (;2;))) (export (;3;) "felt" (type (eq 2))) (type (;4;) (func (param "input1" 1) (param "input2" 1) (param "input3" 1) (param "felt1" 3) (param "felt2" 3) (param "felt3" 3) (param "felt4" 3) (result 3))) (export (;0;) "process-word" (func (type 4))) ) ) - (import "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance (;1;) (type 3))) - (core module (;0;) + (import "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance $miden:cross-ctx-account-word-arg/foo@1.0.0 (;1;) (type $ty-miden:cross-ctx-account-word-arg/foo@1.0.0))) + (core module $main (;0;) (type (;0;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) (type (;1;) (func)) (type (;2;) (func (param f32 f32 f32 f32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32))) + (type (;3;) (func (param f32 f32))) + (type (;4;) (func (param i32) (result f32))) (import "miden:cross-ctx-account-word-arg/foo@1.0.0" "process-word" (func $cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -95,31 +95,31 @@ i32.store8 end ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::assert_eq (;5;) (type 3) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;6;) (type 4) (param f32 f32) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;4;))) - (alias export 1 "process-word" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (core instance (;0;) - (export "process-word" (func 0)) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (alias export $miden:cross-ctx-account-word-arg/foo@1.0.0 "process-word" (func $process-word (;0;))) + (core func $process-word (;0;) (canon lower (func $process-word))) + (core instance $miden:cross-ctx-account-word-arg/foo@1.0.0 (;0;) + (export "process-word" (func $process-word)) ) - (core instance (;1;) (instantiate 0 - (with "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance 0)) + (core instance $main (;1;) (instantiate $main + (with "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance $miden:cross-ctx-account-word-arg/foo@1.0.0)) ) ) - (alias core export 1 "memory" (core memory (;0;))) - (type (;5;) (func (param "arg" 4))) - (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;1;))) - (func (;1;) (type 5) (canon lift (core func 1))) - (alias export 0 "felt" (type (;6;))) - (alias export 0 "word" (type (;7;))) - (component (;0;) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;5;) (func (param "arg" $"#type4 word"))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;1;))) + (func $run (;1;) (type 5) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type6 felt" (@name "felt") (;6;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type7 word" (@name "word") (;7;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -132,12 +132,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;2;) (instantiate 0 - (with "import-func-run" (func 1)) - (with "import-type-felt" (type 6)) - (with "import-type-word" (type 7)) - (with "import-type-word0" (type 4)) + (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $"#type6 felt")) + (with "import-type-word" (type $"#type7 word")) + (with "import-type-word0" (type $"#type4 word")) ) ) - (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) + (export $miden:base/note-script@1.0.0 (;3;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/rust_sdk/pure_rust_add.hir b/tests/integration/expected/rust_sdk/pure_rust_add.hir index 15f1c5485..348c04892 100644 --- a/tests/integration/expected/rust_sdk/pure_rust_add.hir +++ b/tests/integration/expected/rust_sdk/pure_rust_add.hir @@ -1,63 +1,63 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @pure_rust_add { - public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { + private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - builtin.ret v3; + 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; }; - private builtin.function @__rustc::__rust_alloc(v4: i32, v5: i32) -> i32 { - ^block6(v4: i32, v5: i32): - v7 = arith.constant 1048580 : i32; - v8 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::alloc(v7, v5, v4) : i32 - builtin.ret v8; - }; - - private builtin.function @__rustc::__rust_realloc(v9: i32, v10: i32, v11: i32, v12: i32) -> i32 { - ^block8(v9: i32, v10: i32, v11: i32, v12: i32): - v14 = arith.constant 1048580 : i32; - v15 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::alloc(v14, v11, v12) : i32 + 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; - v16 = arith.constant 0 : i32; - v17 = arith.eq v15, v16 : i1; - v18 = arith.zext v17 : u32; - v19 = hir.bitcast v18 : i32; - v21 = arith.neq v19, v178 : i1; - scf.if v21{ - ^block10: + 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: scf.yield ; } else { - ^block11: + ^block9: v177 = arith.constant 0 : i32; - v23 = hir.bitcast v10 : u32; - v22 = hir.bitcast v12 : u32; - v24 = arith.lt v22, v23 : i1; - v25 = arith.zext v24 : u32; - v26 = hir.bitcast v25 : i32; - v28 = arith.neq v26, v177 : i1; - v29 = cf.select v28, v12, v10 : 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; - v31 = arith.eq v29, v176 : i1; - v32 = arith.zext v31 : u32; - v33 = hir.bitcast v32 : i32; - v35 = arith.neq v33, v175 : i1; - scf.if v35{ + 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{ ^block44: scf.yield ; } else { - ^block12: - v36 = hir.bitcast v29 : u32; - v37 = hir.bitcast v15 : u32; - v38 = hir.int_to_ptr v37 : ptr; - v39 = hir.bitcast v9 : u32; - v40 = hir.int_to_ptr v39 : ptr; - hir.mem_cpy v40, v38, v36; + ^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; scf.yield ; }; scf.yield ; }; - builtin.ret v15; + builtin.ret v11; + }; + + 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; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -88,7 +88,7 @@ builtin.component root_ns:root@1.0.0 { scf.yield v185, v181; } else { ^block18: - v63 = hir.exec @root_ns:root@1.0.0/pure_rust_add/core::ptr::alignment::Alignment::max(v43, v56) : i32 + 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]; @@ -190,7 +190,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v122; }; - private builtin.function @core::ptr::alignment::Alignment::max(v124: i32, v125: i32) -> i32 { + private builtin.function @::max(v124: i32, v125: i32) -> i32 { ^block28(v124: i32, v125: i32): v132 = arith.constant 0 : i32; v128 = hir.bitcast v125 : u32; @@ -216,56 +216,50 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v144; }; - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v145: i32, v146: i32, v147: i32, v148: i32) -> i32 { + 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 = hir.exec @root_ns:root@1.0.0/pure_rust_add/wit_bindgen::rt::cabi_realloc(v145, v146, v147, v148) : i32 - builtin.ret v150; - }; - - private builtin.function @wit_bindgen::rt::cabi_realloc(v151: i32, v152: i32, v153: i32, v154: i32) -> i32 { - ^block36(v151: i32, v152: i32, v153: i32, v154: i32): - v156 = arith.constant 0 : i32; - v157 = arith.neq v152, v156 : i1; - v231, v232, v233 = scf.if v157 : i32, i32, u32 { - ^block40: - v165 = hir.exec @root_ns:root@1.0.0/pure_rust_add/__rustc::__rust_realloc(v151, v152, v153, v154) : i32 + v150 = arith.constant 0 : i32; + v151 = arith.neq v146, v150 : i1; + v231, v232, v233 = scf.if v151 : i32, i32, 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 v165, v226, v222; + scf.yield v159, v226, v222; } else { - ^block41: + ^block39: v261 = arith.constant 0 : i32; v262 = arith.constant 0 : i32; - v159 = arith.eq v154, v262 : i1; - v160 = arith.zext v159 : u32; - v161 = hir.bitcast v160 : i32; - v163 = arith.neq v161, v261 : i1; - v249 = scf.if v163 : 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; } else { - ^block42: - v164 = hir.exec @root_ns:root@1.0.0/pure_rust_add/alloc::alloc::alloc(v153, v154) : i32 - scf.yield v164; + ^block40: + v158 = hir.exec @root_ns:root@1.0.0/pure_rust_add/alloc::alloc::alloc(v147, v148) : i32 + scf.yield v158; }; v258 = arith.constant 0 : u32; v227 = arith.constant 1 : u32; - v251 = cf.select v163, v227, v258 : u32; + v251 = cf.select v157, v227, v258 : u32; v259 = ub.poison i32 : i32; - v250 = cf.select v163, v153, v259 : i32; + v250 = cf.select v157, v147, v259 : i32; scf.yield v249, v250, v251; }; v238, v239 = scf.index_switch v233 : i32, u32 case 0 { - ^block39: + ^block37: v256 = arith.constant 0 : i32; - v168 = arith.neq v231, v256 : i1; + v162 = arith.neq v231, v256 : i1; v253 = arith.constant 1 : u32; v254 = arith.constant 0 : u32; - v248 = cf.select v168, v254, v253 : u32; + v248 = cf.select v162, v254, v253 : u32; v255 = ub.poison i32 : i32; - v247 = cf.select v168, v231, v255 : i32; + v247 = cf.select v162, v231, v255 : i32; scf.yield v247, v248; } default { @@ -282,6 +276,12 @@ builtin.component root_ns:root@1.0.0 { 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; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/rust_sdk/pure_rust_add.wat b/tests/integration/expected/rust_sdk/pure_rust_add.wat index 9ef269e25..9c3603187 100644 --- a/tests/integration/expected/rust_sdk/pure_rust_add.wat +++ b/tests/integration/expected/rust_sdk/pure_rust_add.wat @@ -12,18 +12,13 @@ (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 $entrypoint (;0;) (type 0) (param i32 i32) (result i32) - local.get 1 - local.get 0 - i32.add - ) - (func $__rustc::__rust_alloc (;1;) (type 0) (param i32 i32) (result i32) + (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_realloc (;2;) (type 1) (param i32 i32 i32 i32) (result i32) + (func $__rustc::__rust_realloc (;1;) (type 1) (param i32 i32 i32 i32) (result i32) block ;; label = @1 i32.const 1048580 local.get 2 @@ -48,6 +43,11 @@ end local.get 2 ) + (func $entrypoint (;2;) (type 0) (param i32 i32) (result i32) + local.get 1 + local.get 0 + i32.add + ) (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 2) return ) @@ -70,7 +70,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -126,7 +126,7 @@ (func $intrinsics::mem::heap_base (;5;) (type 4) (result i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;6;) (type 0) (param i32 i32) (result i32) + (func $::max (;6;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -147,14 +147,7 @@ local.get 0 call $__rustc::__rust_alloc ) - (func $cabi_realloc_wit_bindgen_0_46_0 (;9;) (type 1) (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 - ) - (func $wit_bindgen::rt::cabi_realloc (;10;) (type 1) (param i32 i32 i32 i32) (result i32) + (func $wit_bindgen::rt::cabi_realloc (;9;) (type 1) (param i32 i32 i32 i32) (result i32) block ;; label = @1 block ;; label = @2 block ;; label = @3 @@ -182,5 +175,12 @@ end local.get 2 ) + (func $cabi_realloc_wit_bindgen_0_46_0 (;10;) (type 1) (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/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 6fe709c9c..ad44ae53e 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 @@ -146,7 +146,7 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v69, v106) + 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 @@ -155,7 +155,7 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v111: i32, v112: i32) { + 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; 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 f19661468..876b3ccb7 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 @@ -443,7 +443,7 @@ proc miden_base_sys::bindings::asset::build_fungible_asset( 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::miden_stdlib_sys::intrinsics::word::Word::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::::reverse trace.252 nop push.32 @@ -459,7 +459,7 @@ proc miden_base_sys::bindings::asset::build_fungible_asset( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 9b631392f..86a1834f9 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32 f32 f32))) @@ -102,13 +102,13 @@ local.get 4 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 4 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -175,16 +175,16 @@ (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") ) - (alias export 0 "asset" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "asset" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $asset))) + (alias core export $main "miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding" (core func $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type5 asset" (@name "asset") (;5;))) + (component $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -199,13 +199,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-asset" (type 5)) - (with "import-type-asset0" (type 1)) + (instance $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-asset" (type $"#type5 asset")) + (with "import-type-asset0" (type $asset)) ) ) - (export (;2;) "miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1 (;2;) "miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1" (instance $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1-shim-instance)) ) 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 edd07831b..74e038fd9 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 @@ -255,7 +255,7 @@ builtin.component miden:rust-sdk-account-asset-build-non-fungible-asset-binding/ 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v119, v182) + 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 @@ -264,7 +264,7 @@ builtin.component miden:rust-sdk-account-asset-build-non-fungible-asset-binding/ builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v187: i32, v188: i32) { + 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; 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 e56aab9d3..86e1f11b9 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 @@ -686,7 +686,7 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( 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_stdlib_sys::intrinsics::word::Word::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::::reverse trace.252 nop push.32 @@ -702,7 +702,7 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 b7c5d29ba..6c4120636 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32 f32 i32))) @@ -146,13 +146,13 @@ local.get 4 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 4 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -219,16 +219,16 @@ (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") ) - (alias export 0 "asset" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "asset" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $asset))) + (alias core export $main "miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding" (core func $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type5 asset" (@name "asset") (;5;))) + (component $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -243,13 +243,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-asset" (type 5)) - (with "import-type-asset0" (type 1)) + (instance $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-asset" (type $"#type5 asset")) + (with "import-type-asset0" (type $asset)) ) ) - (export (;2;) "miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1 (;2;) "miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1" (instance $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1-shim-instance)) ) 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 6913bc8b7..653b6fc5b 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 @@ -61,7 +61,7 @@ builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-acc 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + 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; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-acc builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + 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; 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 648e1c2cf..36b57b5cd 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 @@ -227,7 +227,7 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::::reverse trace.252 nop push.1048584 @@ -388,7 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 6170926eb..e9ec6410d 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -85,7 +85,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -149,15 +149,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding" (core func $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -170,12 +170,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1 (;2;) "miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1" (instance $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1-shim-instance)) ) 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 26d7889b4..8f00994a1 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 @@ -61,7 +61,7 @@ builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-s 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + 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; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-s builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + 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; 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 c37e25772..f717cfe2a 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 @@ -227,7 +227,7 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -388,7 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 bd81f98d2..310292586 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -85,7 +85,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -149,15 +149,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding" (core func $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -170,12 +170,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1 (;2;) "miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1" (instance $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1-shim-instance)) ) 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 4b3318639..c80f86cd9 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 @@ -61,7 +61,7 @@ builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + 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; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + 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; 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 789480bc2..1b8d1157b 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 @@ -227,7 +227,7 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -388,7 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 effe19f48..0bdf9452b 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -85,7 +85,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -149,15 +149,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding" (core func $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -170,12 +170,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1 (;2;) "miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1" (instance $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1-shim-instance)) ) 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 227665026..83f4110d5 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 @@ -220,7 +220,7 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v91, v152) + 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 @@ -262,7 +262,7 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v181: i32, v182: i32) { + 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; 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 c3c4d5650..5a11a910a 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 @@ -572,7 +572,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) movup.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_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::::reverse trace.252 nop push.32 @@ -663,7 +663,7 @@ proc ::reverse( i32, i32 ) 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 61ae53209..e3ffb6438 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -135,7 +135,7 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add @@ -151,7 +151,7 @@ i64.load align=4 i64.store ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;6;) (type 2) (param i32 i32) + (func $::reverse (;6;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -218,16 +218,16 @@ (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") ) - (alias export 0 "asset" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "asset" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $asset))) + (alias core export $main "miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding" (core func $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type5 asset" (@name "asset") (;5;))) + (component $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -242,13 +242,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-asset" (type 5)) - (with "import-type-asset0" (type 1)) + (instance $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-asset" (type $"#type5 asset")) + (with "import-type-asset0" (type $asset)) ) ) - (export (;2;) "miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1 (;2;) "miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1" (instance $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1-shim-instance)) ) 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 3c46b0634..0452bc2ca 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 @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + 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 @@ -151,7 +151,7 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + 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; 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 0e41a17b9..6b29a040b 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 @@ -420,7 +420,7 @@ proc miden_base_sys::bindings::faucet::create_fungible_asset( 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::miden_stdlib_sys::intrinsics::word::Word::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::::reverse trace.252 nop push.32 @@ -436,7 +436,7 @@ proc miden_base_sys::bindings::faucet::create_fungible_asset( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 19f9746ec..9e232b484 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -96,13 +96,13 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -169,16 +169,16 @@ (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") ) - (alias export 0 "asset" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "asset" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $asset))) + (alias core export $main "miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding" (core func $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type5 asset" (@name "asset") (;5;))) + (component $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -193,13 +193,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-asset" (type 5)) - (with "import-type-asset0" (type 1)) + (instance $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-asset" (type $"#type5 asset")) + (with "import-type-asset0" (type $asset)) ) ) - (export (;2;) "miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1 (;2;) "miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1" (instance $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1-shim-instance)) ) 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 3c51af74d..5096ba1bb 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 @@ -247,7 +247,7 @@ builtin.component miden:rust-sdk-account-faucet-create-non-fungible-asset-bindin 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v113, v174) + 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 @@ -256,7 +256,7 @@ builtin.component miden:rust-sdk-account-faucet-create-non-fungible-asset-bindin builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v179: i32, v180: i32) { + 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; 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 07b643c22..e8dc4d3a4 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 @@ -637,7 +637,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 @@ -653,7 +653,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 590b22574..81d15beed 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -138,13 +138,13 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 2) (param i32 i32) + (func $::reverse (;5;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -211,16 +211,16 @@ (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") ) - (alias export 0 "asset" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "asset" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $asset))) + (alias core export $main "miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding" (core func $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type5 asset" (@name "asset") (;5;))) + (component $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -235,13 +235,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-asset" (type 5)) - (with "import-type-asset0" (type 1)) + (instance $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-asset" (type $"#type5 asset")) + (with "import-type-asset0" (type $asset)) ) ) - (export (;2;) "miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1 (;2;) "miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1" (instance $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1-shim-instance)) ) 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 e0a015d57..fcbbee612 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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))) (table (;0;) 2 2 funcref) @@ -46,14 +46,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding" (core func $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-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-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-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))) @@ -63,11 +63,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-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 (;2;) "miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1 (;2;) "miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1" (instance $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1-shim-instance)) ) 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 ce629ad80..7759bb76c 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 @@ -181,16 +181,16 @@ builtin.component miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-bin builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v119: i32) -> felt { - ^block21(v119: i32): - v120 = hir.bitcast v119 : felt; - builtin.ret v120; + 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::eq(v122: felt, v123: felt) -> i32 { - ^block23(v122: felt, v123: felt): - v124 = arith.eq v122, v123 : i1; - v125 = hir.cast v124 : i32; + private builtin.function @intrinsics::felt::from_u32(v124: i32) -> felt { + ^block23(v124: i32): + v125 = hir.bitcast v124 : felt; builtin.ret v125; }; 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 39e2c34dd..60cf7c54b 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 @@ -419,13 +419,13 @@ proc felt - nop +proc intrinsics::felt::eq(felt, felt) -> i32 + eq end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") 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 560c4cdb7..a521d7335 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 @@ -1,17 +1,17 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param f32 f32) (result i32))) + (type (;4;) (func (param i32) (result f32))) (type (;5;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -110,10 +110,10 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;6;) (type 4) (param f32 f32) (result i32) + (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) @@ -122,14 +122,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "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" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding" (core func $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 (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $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))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type3 felt" (@name "felt") (;3;))) + (component $miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-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))) @@ -139,11 +139,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-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 (;2;) "miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1 (;2;) "miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1" (instance $miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1-shim-instance)) ) 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 f22d25f15..b54f917ff 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 @@ -220,7 +220,7 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v91, v152) + 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 @@ -262,7 +262,7 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v181: i32, v182: i32) { + 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; 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 48d85972a..c12ec5296 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 @@ -572,7 +572,7 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) movup.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_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::::reverse trace.252 nop push.32 @@ -663,7 +663,7 @@ proc ::reverse( i32, i32 ) 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 e65684382..8f5fecc26 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "asset" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -135,7 +135,7 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add @@ -151,7 +151,7 @@ i64.load align=4 i64.store ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;6;) (type 2) (param i32 i32) + (func $::reverse (;6;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -218,16 +218,16 @@ (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") ) - (alias export 0 "asset" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "asset" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $asset))) + (alias core export $main "miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding" (core func $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "asset" (type $"#type5 asset" (@name "asset") (;5;))) + (component $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -242,13 +242,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-asset" (type 5)) - (with "import-type-asset0" (type 1)) + (instance $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-asset" (type $"#type5 asset")) + (with "import-type-asset0" (type $asset)) ) ) - (export (;2;) "miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1 (;2;) "miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1" (instance $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1-shim-instance)) ) 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 a76522173..e44b3f046 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 @@ -61,7 +61,7 @@ builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-ac 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + 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; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-ac builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + 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; 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 f525bc45d..cacd0e0fe 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 @@ -227,7 +227,7 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -388,7 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 e2502890c..21eb9c1ae 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -85,7 +85,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -149,15 +149,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding" (core func $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -170,12 +170,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1 (;2;) "miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1" (instance $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1-shim-instance)) ) 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 83e879350..f66a1b91b 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32) (result f32))) @@ -55,14 +55,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding" (core func $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-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-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-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))) @@ -72,11 +72,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-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 (;2;) "miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1 (;2;) "miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1" (instance $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1-shim-instance)) ) 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 a009c558d..7403d4a7b 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 @@ -61,7 +61,7 @@ builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/ 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + 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; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/ builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + 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; 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 7a92543ac..665e28f98 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 @@ -227,7 +227,7 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -388,7 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 91fa84d87..5a66e339d 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -85,7 +85,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -149,15 +149,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding" (core func $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -170,12 +170,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1 (;2;) "miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1" (instance $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1-shim-instance)) ) 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 94e0ffad0..d8e13a4ee 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 @@ -61,7 +61,7 @@ builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + 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; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + 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; 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 d18921eda..02bc36a4e 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 @@ -227,7 +227,7 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -388,7 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 2fbe10f7f..36249d65c 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -85,7 +85,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -149,15 +149,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding" (core func $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -170,12 +170,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1 (;2;) "miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1" (instance $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1-shim-instance)) ) 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 1407da20a..6508d8ebc 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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))) (table (;0;) 2 2 funcref) @@ -46,14 +46,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding" (core func $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-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-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-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))) @@ -63,11 +63,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-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 (;2;) "miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1 (;2;) "miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1" (instance $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1-shim-instance)) ) 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 92d033d0d..90bc41dfe 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 @@ -63,7 +63,7 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v43) + 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; @@ -136,104 +136,96 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc builtin.ret ; }; - private builtin.function @>::from(v95: i32) -> felt { - ^block15(v95: i32): - v97 = arith.constant 255 : i32; - v98 = arith.band v95, v97 : i32; - v99 = hir.bitcast v98 : felt; - builtin.ret v99; - }; - - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v100: i32, v101: i32) { - ^block17(v100: i32, v101: i32): - v104 = 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 - v105 = hir.bitcast v104 : ptr; - v106 = hir.load v105 : i32; - v107 = arith.constant 16 : i32; - v108 = arith.sub v106, v107 : i32 #[overflow = wrapping]; - v110 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v110 : u32 #[overflow = checked]; + 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; - v113 = arith.mod v111, v336 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - v115 = hir.load v114 : i64; + 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; - v116 = hir.bitcast v108 : u32; - v118 = arith.add v116, v335 : u32 #[overflow = checked]; - v119 = arith.constant 4 : u32; - v120 = arith.mod v118, v119 : u32; - hir.assertz v120 #[code = 250]; - v121 = hir.int_to_ptr v118 : ptr; - hir.store v121, v115; - v122 = hir.bitcast v101 : 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; - v124 = arith.mod v122, v334 : 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; - v126 = hir.load v125 : i64; - v127 = hir.bitcast v108 : u32; - v333 = arith.constant 4 : u32; - v129 = arith.mod v127, v333 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - hir.store v130, v126; - v131 = arith.constant 12 : i32; - v132 = arith.add v108, v131 : i32 #[overflow = wrapping]; - v102 = arith.constant 0 : i32; - v304, v305, v306, v307, v308, v309 = scf.while v102, v108, v132, v100 : i32, i32, i32, i32, i32, i32 { + 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; - v135 = arith.constant 8 : i32; - v136 = arith.eq v310, v135 : i1; - v137 = arith.zext v136 : u32; - v138 = hir.bitcast v137 : i32; - v140 = arith.neq v138, v332 : i1; - v298, v299 = scf.if v140 : i32, 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 { - ^block22: - v142 = arith.add v311, v310 : i32 #[overflow = wrapping]; - v143 = hir.bitcast v142 : u32; + ^block20: + v137 = arith.add v311, v310 : i32 #[overflow = wrapping]; + v138 = hir.bitcast v137 : u32; v331 = arith.constant 4 : u32; - v145 = arith.mod v143, v331 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - v147 = hir.load v146 : felt; - v149 = hir.bitcast v312 : 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; - v151 = arith.mod v149, v330 : 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; - v153 = hir.load v152 : i32; - v154 = hir.bitcast v142 : u32; - v329 = arith.constant 4 : u32; - v156 = arith.mod v154, v329 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - hir.store v157, v153; - v158 = hir.bitcast v312 : u32; + hir.store v152, v148; + v153 = hir.bitcast v312 : u32; v328 = arith.constant 4 : u32; - v160 = arith.mod v158, v328 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - hir.store v161, v147; - v164 = arith.constant -4 : i32; - v165 = arith.add v312, v164 : i32 #[overflow = wrapping]; - v162 = arith.constant 4 : i32; - v163 = arith.add v310, v162 : i32 #[overflow = wrapping]; - scf.yield v163, v165; + 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 v140, v326, v313 : i32; + v301 = cf.select v135, v326, v313 : i32; v327 = ub.poison i32 : i32; - v300 = cf.select v140, v327, v311 : i32; + v300 = cf.select v135, v327, v311 : i32; v257 = arith.constant 1 : u32; v250 = arith.constant 0 : u32; - v303 = cf.select v140, v250, v257 : u32; + v303 = cf.select v135, v250, v257 : u32; v291 = arith.trunc v303 : i1; scf.condition v291, v298, v300, v299, v301, v311, v313; } do { @@ -241,36 +233,44 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc scf.yield v314, v315, v316, v317; }; v325 = arith.constant 8 : u32; - v167 = hir.bitcast v308 : u32; - v169 = arith.add v167, v325 : u32 #[overflow = checked]; + v162 = hir.bitcast v308 : u32; + v164 = arith.add v162, v325 : u32 #[overflow = checked]; v324 = arith.constant 4 : u32; - v171 = arith.mod v169, v324 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - v173 = hir.load v172 : i64; + 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; - v174 = hir.bitcast v309 : u32; - v176 = arith.add v174, v323 : u32 #[overflow = checked]; + v169 = hir.bitcast v309 : u32; + v171 = arith.add v169, v323 : u32 #[overflow = checked]; v322 = arith.constant 8 : u32; - v178 = arith.mod v176, v322 : u32; - hir.assertz v178 #[code = 250]; - v179 = hir.int_to_ptr v176 : ptr; - hir.store v179, v173; - v180 = hir.bitcast v308 : 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; - v182 = arith.mod v180, v321 : 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; - v184 = hir.load v183 : i64; - v185 = hir.bitcast v309 : u32; - v320 = arith.constant 8 : u32; - v187 = arith.mod v185, v320 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - hir.store v188, v184; + 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_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 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 b7d91341c..50e493edf 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 @@ -234,7 +234,7 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -395,15 +395,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -679,6 +671,14 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( nop end +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + @callconv("C") proc miden::active_account::get_procedure_root(felt, i32) trace.240 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 61608278d..2ac6df6ad 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,12 +8,12 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) - (type (;2;) (func (param i32) (result f32))) - (type (;3;) (func (param i32 i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -52,7 +52,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -88,13 +88,7 @@ i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -152,21 +146,27 @@ 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 $miden::active_account::get_procedure_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_account_get_procedure_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding" (core func $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -179,12 +179,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1 (;2;) "miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1" (instance $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1-shim-instance)) ) 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 229e8ad52..447135f4b 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 @@ -61,7 +61,7 @@ builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + 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; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + 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; 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 ed1397dd7..fa2da2547 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 @@ -227,7 +227,7 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro dup.2 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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -388,7 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 a557b6123..a2eaab106 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 i32))) @@ -49,7 +49,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -85,7 +85,7 @@ i32.store8 end ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -149,15 +149,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding" (core func $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -170,12 +170,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1 (;2;) "miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1" (instance $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1-shim-instance)) ) 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 06305f989..ecf68d20d 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 @@ -181,16 +181,16 @@ builtin.component miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v119: i32) -> felt { - ^block21(v119: i32): - v120 = hir.bitcast v119 : felt; - builtin.ret v120; + 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::eq(v122: felt, v123: felt) -> i32 { - ^block23(v122: felt, v123: felt): - v124 = arith.eq v122, v123 : i1; - v125 = hir.cast v124 : i32; + private builtin.function @intrinsics::felt::from_u32(v124: i32) -> felt { + ^block23(v124: i32): + v125 = hir.bitcast v124 : felt; builtin.ret v125; }; 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 9b8571bb4..d0c7bd79e 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 @@ -419,13 +419,13 @@ proc felt - nop +proc intrinsics::felt::eq(felt, felt) -> i32 + eq end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") 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 cbba63fa3..eb0315937 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 @@ -1,17 +1,17 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param f32 f32) (result i32))) + (type (;4;) (func (param i32) (result f32))) (type (;5;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -110,10 +110,10 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;6;) (type 4) (param f32 f32) (result i32) + (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) @@ -122,14 +122,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding" (core func $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-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-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-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))) @@ -139,11 +139,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-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 (;2;) "miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1 (;2;) "miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1" (instance $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1-shim-instance)) ) 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 6f3e8613f..75b0ef57b 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 @@ -143,16 +143,16 @@ builtin.component miden:rust-sdk-account-has-procedure-binding/rust-sdk-account- builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v91: i32) -> felt { - ^block19(v91: i32): - v92 = hir.bitcast v91 : felt; - builtin.ret v92; + 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::eq(v94: felt, v95: felt) -> i32 { - ^block21(v94: felt, v95: felt): - v96 = arith.eq v94, v95 : i1; - v97 = hir.cast v96 : i32; + private builtin.function @intrinsics::felt::from_u32(v96: i32) -> felt { + ^block21(v96: i32): + v97 = hir.bitcast v96 : felt; builtin.ret v97; }; 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 1e1346464..4e8af43de 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 @@ -333,13 +333,13 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::eq(felt, felt) -> i32 + eq end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") 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 26123d468..fa55f4157 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 @@ -1,16 +1,16 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32) (result f32))) - (type (;3;) (func (param f32 f32) (result i32))) + (type (;2;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param i32) (result f32))) (type (;4;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -92,10 +92,10 @@ i32.store8 end ) - (func $intrinsics::felt::from_u32 (;4;) (type 2) (param i32) (result f32) + (func $intrinsics::felt::eq (;4;) (type 2) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) + (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) @@ -104,14 +104,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding" (core func $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-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-account-has-procedure-binding/rust-sdk-account-has-procedure-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))) @@ -121,11 +121,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-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 (;2;) "miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1 (;2;) "miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1" (instance $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1-shim-instance)) ) 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 c8b5b829e..7f28e0016 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 @@ -63,7 +63,7 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v43) + 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; @@ -136,104 +136,96 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s builtin.ret ; }; - private builtin.function @>::from(v95: i32) -> felt { - ^block15(v95: i32): - v97 = arith.constant 255 : i32; - v98 = arith.band v95, v97 : i32; - v99 = hir.bitcast v98 : felt; - builtin.ret v99; - }; - - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v100: i32, v101: i32) { - ^block17(v100: i32, v101: i32): - v104 = 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 - v105 = hir.bitcast v104 : ptr; - v106 = hir.load v105 : i32; - v107 = arith.constant 16 : i32; - v108 = arith.sub v106, v107 : i32 #[overflow = wrapping]; - v110 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v110 : u32 #[overflow = checked]; + 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; - v113 = arith.mod v111, v336 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - v115 = hir.load v114 : i64; + 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; - v116 = hir.bitcast v108 : u32; - v118 = arith.add v116, v335 : u32 #[overflow = checked]; - v119 = arith.constant 4 : u32; - v120 = arith.mod v118, v119 : u32; - hir.assertz v120 #[code = 250]; - v121 = hir.int_to_ptr v118 : ptr; - hir.store v121, v115; - v122 = hir.bitcast v101 : 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; - v124 = arith.mod v122, v334 : 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; - v126 = hir.load v125 : i64; - v127 = hir.bitcast v108 : u32; - v333 = arith.constant 4 : u32; - v129 = arith.mod v127, v333 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - hir.store v130, v126; - v131 = arith.constant 12 : i32; - v132 = arith.add v108, v131 : i32 #[overflow = wrapping]; - v102 = arith.constant 0 : i32; - v304, v305, v306, v307, v308, v309 = scf.while v102, v108, v132, v100 : i32, i32, i32, i32, i32, i32 { + 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; - v135 = arith.constant 8 : i32; - v136 = arith.eq v310, v135 : i1; - v137 = arith.zext v136 : u32; - v138 = hir.bitcast v137 : i32; - v140 = arith.neq v138, v332 : i1; - v298, v299 = scf.if v140 : i32, 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 { - ^block22: - v142 = arith.add v311, v310 : i32 #[overflow = wrapping]; - v143 = hir.bitcast v142 : u32; + ^block20: + v137 = arith.add v311, v310 : i32 #[overflow = wrapping]; + v138 = hir.bitcast v137 : u32; v331 = arith.constant 4 : u32; - v145 = arith.mod v143, v331 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - v147 = hir.load v146 : felt; - v149 = hir.bitcast v312 : 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; - v151 = arith.mod v149, v330 : 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; - v153 = hir.load v152 : i32; - v154 = hir.bitcast v142 : u32; - v329 = arith.constant 4 : u32; - v156 = arith.mod v154, v329 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - hir.store v157, v153; - v158 = hir.bitcast v312 : u32; + hir.store v152, v148; + v153 = hir.bitcast v312 : u32; v328 = arith.constant 4 : u32; - v160 = arith.mod v158, v328 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - hir.store v161, v147; - v164 = arith.constant -4 : i32; - v165 = arith.add v312, v164 : i32 #[overflow = wrapping]; - v162 = arith.constant 4 : i32; - v163 = arith.add v310, v162 : i32 #[overflow = wrapping]; - scf.yield v163, v165; + 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 v140, v326, v313 : i32; + v301 = cf.select v135, v326, v313 : i32; v327 = ub.poison i32 : i32; - v300 = cf.select v140, v327, v311 : i32; + v300 = cf.select v135, v327, v311 : i32; v257 = arith.constant 1 : u32; v250 = arith.constant 0 : u32; - v303 = cf.select v140, v250, v257 : u32; + v303 = cf.select v135, v250, v257 : u32; v291 = arith.trunc v303 : i1; scf.condition v291, v298, v300, v299, v301, v311, v313; } do { @@ -241,36 +233,44 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s scf.yield v314, v315, v316, v317; }; v325 = arith.constant 8 : u32; - v167 = hir.bitcast v308 : u32; - v169 = arith.add v167, v325 : u32 #[overflow = checked]; + v162 = hir.bitcast v308 : u32; + v164 = arith.add v162, v325 : u32 #[overflow = checked]; v324 = arith.constant 4 : u32; - v171 = arith.mod v169, v324 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - v173 = hir.load v172 : i64; + 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; - v174 = hir.bitcast v309 : u32; - v176 = arith.add v174, v323 : u32 #[overflow = checked]; + v169 = hir.bitcast v309 : u32; + v171 = arith.add v169, v323 : u32 #[overflow = checked]; v322 = arith.constant 8 : u32; - v178 = arith.mod v176, v322 : u32; - hir.assertz v178 #[code = 250]; - v179 = hir.int_to_ptr v176 : ptr; - hir.store v179, v173; - v180 = hir.bitcast v308 : 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; - v182 = arith.mod v180, v321 : 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; - v184 = hir.load v183 : i64; - v185 = hir.bitcast v309 : u32; - v320 = arith.constant 8 : u32; - v187 = arith.mod v185, v320 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - hir.store v188, v184; + 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 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 bb8a10b22..29fe9feb2 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 @@ -234,7 +234,7 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st dup.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_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -395,15 +395,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -679,6 +671,14 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( nop end +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + @callconv("C") proc miden::active_account::get_initial_item(felt, i32) trace.240 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 1170355f7..d40af96d1 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,12 +8,12 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) - (type (;2;) (func (param i32) (result f32))) - (type (;3;) (func (param i32 i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -52,7 +52,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -88,13 +88,7 @@ i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -152,21 +146,27 @@ 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 $miden::active_account::get_initial_item (;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) "crust_sdk_account_storage_get_initial_item_binding\01\0b0.0.1\03\01\01\00\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding" (core func $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -179,12 +179,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1 (;2;) "miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1" (instance $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1-shim-instance)) ) 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 6b8215b99..25f9dd841 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 @@ -138,7 +138,7 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v339, v93) + 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; @@ -211,104 +211,96 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru builtin.ret ; }; - private builtin.function @>::from(v145: i32) -> felt { - ^block19(v145: i32): - v147 = arith.constant 255 : i32; - v148 = arith.band v145, v147 : i32; - v149 = hir.bitcast v148 : felt; - builtin.ret v149; - }; - - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v150: i32, v151: i32) { - ^block21(v150: i32, v151: i32): - v154 = 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 - v155 = hir.bitcast v154 : ptr; - v156 = hir.load v155 : i32; - v157 = arith.constant 16 : i32; - v158 = arith.sub v156, v157 : i32 #[overflow = wrapping]; - v160 = arith.constant 8 : u32; - v159 = hir.bitcast v151 : u32; - v161 = arith.add v159, v160 : u32 #[overflow = checked]; + 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; - v163 = arith.mod v161, v459 : u32; - hir.assertz v163 #[code = 250]; - v164 = hir.int_to_ptr v161 : ptr; - v165 = hir.load v164 : i64; + 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; - v166 = hir.bitcast v158 : u32; - v168 = arith.add v166, v458 : u32 #[overflow = checked]; - v169 = arith.constant 4 : u32; - v170 = arith.mod v168, v169 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - hir.store v171, v165; - v172 = hir.bitcast v151 : 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; - v174 = arith.mod v172, v457 : 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; - v176 = hir.load v175 : i64; - v177 = hir.bitcast v158 : u32; - v456 = arith.constant 4 : u32; - v179 = arith.mod v177, v456 : u32; - hir.assertz v179 #[code = 250]; - v180 = hir.int_to_ptr v177 : ptr; - hir.store v180, v176; - v181 = arith.constant 12 : i32; - v182 = arith.add v158, v181 : i32 #[overflow = wrapping]; - v152 = arith.constant 0 : i32; - v427, v428, v429, v430, v431, v432 = scf.while v152, v158, v182, v150 : i32, i32, i32, i32, i32, i32 { + 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; - v185 = arith.constant 8 : i32; - v186 = arith.eq v433, v185 : i1; - v187 = arith.zext v186 : u32; - v188 = hir.bitcast v187 : i32; - v190 = arith.neq v188, v455 : i1; - v421, v422 = scf.if v190 : i32, 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 { - ^block26: - v192 = arith.add v434, v433 : i32 #[overflow = wrapping]; - v193 = hir.bitcast v192 : u32; + ^block24: + v187 = arith.add v434, v433 : i32 #[overflow = wrapping]; + v188 = hir.bitcast v187 : u32; v454 = arith.constant 4 : u32; - v195 = arith.mod v193, v454 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - v197 = hir.load v196 : felt; - v199 = hir.bitcast v435 : 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; - v201 = arith.mod v199, v453 : 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; - v203 = hir.load v202 : i32; - v204 = hir.bitcast v192 : u32; - v452 = arith.constant 4 : u32; - v206 = arith.mod v204, v452 : u32; - hir.assertz v206 #[code = 250]; - v207 = hir.int_to_ptr v204 : ptr; - hir.store v207, v203; - v208 = hir.bitcast v435 : u32; + hir.store v202, v198; + v203 = hir.bitcast v435 : u32; v451 = arith.constant 4 : u32; - v210 = arith.mod v208, v451 : u32; - hir.assertz v210 #[code = 250]; - v211 = hir.int_to_ptr v208 : ptr; - hir.store v211, v197; - v214 = arith.constant -4 : i32; - v215 = arith.add v435, v214 : i32 #[overflow = wrapping]; - v212 = arith.constant 4 : i32; - v213 = arith.add v433, v212 : i32 #[overflow = wrapping]; - scf.yield v213, v215; + 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 v190, v449, v436 : i32; + v424 = cf.select v185, v449, v436 : i32; v450 = ub.poison i32 : i32; - v423 = cf.select v190, v450, v434 : i32; + v423 = cf.select v185, v450, v434 : i32; v380 = arith.constant 1 : u32; v373 = arith.constant 0 : u32; - v426 = cf.select v190, v373, v380 : u32; + v426 = cf.select v185, v373, v380 : u32; v414 = arith.trunc v426 : i1; scf.condition v414, v421, v423, v422, v424, v434, v436; } do { @@ -316,36 +308,44 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru scf.yield v437, v438, v439, v440; }; v448 = arith.constant 8 : u32; - v217 = hir.bitcast v431 : u32; - v219 = arith.add v217, v448 : u32 #[overflow = checked]; + v212 = hir.bitcast v431 : u32; + v214 = arith.add v212, v448 : u32 #[overflow = checked]; v447 = arith.constant 4 : u32; - v221 = arith.mod v219, v447 : u32; - hir.assertz v221 #[code = 250]; - v222 = hir.int_to_ptr v219 : ptr; - v223 = hir.load v222 : i64; + 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; - v224 = hir.bitcast v432 : u32; - v226 = arith.add v224, v446 : u32 #[overflow = checked]; + v219 = hir.bitcast v432 : u32; + v221 = arith.add v219, v446 : u32 #[overflow = checked]; v445 = arith.constant 8 : u32; - v228 = arith.mod v226, v445 : u32; - hir.assertz v228 #[code = 250]; - v229 = hir.int_to_ptr v226 : ptr; - hir.store v229, v223; - v230 = hir.bitcast v431 : 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; - v232 = arith.mod v230, v444 : 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; - v234 = hir.load v233 : i64; - v235 = hir.bitcast v432 : u32; - v443 = arith.constant 8 : u32; - v237 = arith.mod v235, v443 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - hir.store v238, v234; + 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; 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 2b4fdc53a..adbc69a68 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 @@ -383,7 +383,7 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 trace.252 nop push.1048584 @@ -544,15 +544,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - -@callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -828,6 +820,14 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( nop end +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + @callconv("C") proc intrinsics::felt::from_u32(i32) -> felt nop 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 276c8cb58..4814ce159 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,12 +8,12 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) - (type (;2;) (func (param i32) (result f32))) - (type (;3;) (func (param i32 i32))) + (type (;2;) (func (param i32 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) @@ -93,7 +93,7 @@ local.get 0 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 1048584 i32.add @@ -129,13 +129,7 @@ i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;4;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -193,7 +187,13 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;6;) (type 2) (param i32) (result f32) + (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 (;6;) (type 3) (param i32) (result f32) unreachable ) (func $miden::active_account::get_initial_map_item (;7;) (type 4) (param f32 f32 f32 f32 f32 i32) @@ -202,15 +202,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding" (core func $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -223,12 +223,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1 (;2;) "miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1" (instance $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1-shim-instance)) ) 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 c91a372b1..69b64926d 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 @@ -107,7 +107,7 @@ builtin.component miden:base/transaction-script@1.0.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v39, v73) + 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 @@ -116,7 +116,7 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v78: i32, v79: i32) { + 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; 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 8fbdefa36..c26d9cf25 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 @@ -278,7 +278,7 @@ proc miden_base_sys::bindings::tx::get_block_commitment( movup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::::reverse trace.252 nop push.32 @@ -294,7 +294,7 @@ proc miden_base_sys::bindings::tx::get_block_commitment( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 e0a6b2573..8ff0e6246 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (param i32))) @@ -77,13 +77,13 @@ local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -146,15 +146,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -167,12 +167,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 b9ef305d9..434eebee1 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (result f32))) @@ -53,15 +53,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -74,12 +74,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 96d17327b..5a516a14c 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (result f32))) @@ -53,15 +53,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -74,12 +74,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 f9e7d65c2..583e87c04 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (result f32))) @@ -53,15 +53,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -74,12 +74,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 5c1169117..ea14cf714 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 @@ -107,7 +107,7 @@ builtin.component miden:base/transaction-script@1.0.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v39, v73) + 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 @@ -116,7 +116,7 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v78: i32, v79: i32) { + 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; 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 b149f4fe8..5fd5a04ae 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 @@ -278,7 +278,7 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( movup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::::reverse trace.252 nop push.32 @@ -294,7 +294,7 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 8a95faf52..827c2eba1 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (param i32))) @@ -77,13 +77,13 @@ local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -146,15 +146,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -167,12 +167,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 291ebc0e8..51490aa8a 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (result f32))) @@ -53,15 +53,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -74,12 +74,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 a7dd87fd1..943ea3ff8 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (result f32))) @@ -53,15 +53,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -74,12 +74,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 7d534fe20..80d5aedf9 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 @@ -107,7 +107,7 @@ builtin.component miden:base/transaction-script@1.0.0 { 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v39, v73) + 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 @@ -116,7 +116,7 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v78: i32, v79: i32) { + 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; 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 52c68de9e..365eeae7a 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 @@ -278,7 +278,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( movup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::::reverse trace.252 nop push.32 @@ -294,7 +294,7 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 c8ce1a761..6b475738c 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (param i32))) @@ -77,13 +77,13 @@ local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -146,15 +146,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -167,12 +167,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 c70f22783..39aab6d37 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (type (;2;) (func (param f32))) @@ -59,15 +59,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/transaction-script@1.0.0#run" (core func $miden:base/transaction-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/transaction-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -80,12 +80,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) + (export $miden:base/transaction-script@1.0.0 (;2;) "miden:base/transaction-script@1.0.0" (instance $miden:base/transaction-script@1.0.0-shim-instance)) ) 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 c4b4d0433..5f725a4d0 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 @@ -143,16 +143,16 @@ builtin.component miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-a builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v91: i32) -> felt { - ^block19(v91: i32): - v92 = hir.bitcast v91 : felt; - builtin.ret v92; + 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::eq(v94: felt, v95: felt) -> i32 { - ^block21(v94: felt, v95: felt): - v96 = arith.eq v94, v95 : i1; - v97 = hir.cast v96 : i32; + private builtin.function @intrinsics::felt::from_u32(v96: i32) -> felt { + ^block21(v96: i32): + v97 = hir.bitcast v96 : felt; builtin.ret v97; }; 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 f1aa6eb09..2774306af 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 @@ -333,13 +333,13 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop +proc intrinsics::felt::eq(felt, felt) -> i32 + eq end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq +proc intrinsics::felt::from_u32(i32) -> felt + nop end @callconv("C") 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 69549fbd9..03940a791 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 @@ -1,16 +1,16 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32) (result f32))) - (type (;3;) (func (param f32 f32) (result i32))) + (type (;2;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param i32) (result f32))) (type (;4;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -92,10 +92,10 @@ i32.store8 end ) - (func $intrinsics::felt::from_u32 (;4;) (type 2) (param i32) (result f32) + (func $intrinsics::felt::eq (;4;) (type 2) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) + (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) @@ -104,14 +104,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding" (core func $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-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-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-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))) @@ -121,11 +121,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-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 (;2;) "miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1 (;2;) "miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1" (instance $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1-shim-instance)) ) 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 68b991703..6ce5b8478 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,7 +10,7 @@ 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 1048612 : 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; @@ -26,36 +26,36 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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 1048612 : 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 - v666 = arith.constant 0 : 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, v666 : i1; + v26 = arith.neq v24, v656 : i1; scf.if v26{ ^block13: scf.yield ; } else { ^block14: - v664 = arith.constant 0 : i32; - v665 = arith.constant 0 : i32; - v28 = arith.eq v12, v665 : i1; + 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, v664 : i1; + v32 = arith.neq v30, v654 : i1; scf.if v32{ ^block94: scf.yield ; } else { ^block15: - v658 = arith.constant 0 : u8; + 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, v658; + hir.mem_set v37, v35, v648; scf.yield ; }; scf.yield ; @@ -93,12 +93,12 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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 - v668 = arith.constant 16 : i32; - v669 = arith.constant 4 : i32; - v62 = arith.add v46, v669 : 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::raw_vec::RawVecInner::deallocate(v62, v668, v668) - v667 = arith.constant 16 : i32; - v66 = arith.add v46, v667 : i32 #[overflow = wrapping]; + 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; @@ -115,7 +115,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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 1048616 : 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; @@ -133,12 +133,12 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v83 = hir.bitcast v82 : ptr; v84 = hir.load v83 : 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/__wasm_call_ctors() - v671 = arith.constant 1 : u8; - v673 = arith.constant 1048616 : i32; - v86 = arith.add v84, v673 : i32 #[overflow = wrapping]; + 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, v671; + hir.store v91, v661; scf.yield ; }; builtin.ret ; @@ -148,27 +148,27 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no ^block26(v92: i32, v93: i32, v94: i32): v97 = arith.constant 16 : i32; v96 = arith.constant 0 : i32; - v675 = arith.constant 16 : u32; + v665 = arith.constant 16 : u32; v99 = hir.bitcast v93 : u32; - v101 = arith.gt v99, v675 : i1; + 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; - v715 = arith.constant 0 : 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, v715 : i1; - v684, v685 = scf.if v111 : i32, u32 { + v111 = arith.neq v109, v705 : i1; + v674, v675 = scf.if v111 : i32, u32 { ^block100: - v676 = arith.constant 0 : u32; - v680 = ub.poison i32 : i32; - scf.yield v680, v676; + v666 = arith.constant 0 : u32; + v670 = ub.poison i32 : i32; + scf.yield v670, v666; } 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/core::ptr::alignment::Alignment::max(v93, v106) : i32 - v714 = arith.constant 0 : i32; + 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; @@ -176,18 +176,18 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v117 = arith.gt v115, v116 : i1; v118 = arith.zext v117 : u32; v119 = hir.bitcast v118 : i32; - v121 = arith.neq v119, v714 : i1; - v699 = scf.if v121 : i32 { + v121 = arith.neq v119, v704 : i1; + v689 = scf.if v121 : i32 { ^block99: - v713 = ub.poison i32 : i32; - scf.yield v713; + v703 = ub.poison i32 : i32; + scf.yield v703; } else { ^block30: - v711 = arith.constant 0 : i32; - v127 = arith.sub v711, v113 : i32 #[overflow = wrapping]; - v712 = arith.constant -1 : i32; + 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, v712 : 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; @@ -195,8 +195,8 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no hir.assertz v131 #[code = 250]; v132 = hir.int_to_ptr v129 : ptr; v133 = hir.load v132 : i32; - v710 = arith.constant 0 : i32; - v135 = arith.neq v133, v710 : i1; + v700 = arith.constant 0 : i32; + v135 = arith.neq v133, v700 : i1; scf.if v135{ ^block98: scf.yield ; @@ -205,41 +205,41 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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; - v709 = arith.constant 4 : u32; - v145 = arith.mod v143, v709 : u32; + v699 = arith.constant 4 : u32; + v145 = arith.mod v143, v699 : u32; hir.assertz v145 #[code = 250]; - v708 = arith.constant 16 : u32; + v698 = arith.constant 16 : u32; v138 = hir.bitcast v137 : i32; - v141 = arith.shl v138, v708 : 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; scf.yield ; }; v149 = hir.bitcast v92 : u32; - v707 = arith.constant 4 : u32; - v151 = arith.mod v149, v707 : 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; - v705 = arith.constant 0 : i32; - v706 = arith.constant -1 : i32; - v155 = arith.bxor v153, v706 : 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, v705 : i1; - v698 = scf.if v162 : i32 { + v162 = arith.neq v160, v695 : i1; + v688 = scf.if v162 : i32 { ^block33: - v704 = arith.constant 0 : i32; - scf.yield v704; + v694 = arith.constant 0 : i32; + scf.yield v694; } else { ^block34: v164 = hir.bitcast v92 : u32; - v703 = arith.constant 4 : u32; - v166 = arith.mod v164, v703 : 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; @@ -247,20 +247,20 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; scf.yield v169; }; - scf.yield v698; + scf.yield v688; }; - v681 = arith.constant 1 : u32; - v702 = arith.constant 0 : u32; - v700 = cf.select v121, v702, v681 : u32; - scf.yield v699, v700; + v671 = arith.constant 1 : u32; + v692 = arith.constant 0 : u32; + v690 = cf.select v121, v692, v671 : u32; + scf.yield v689, v690; }; - v701 = arith.constant 0 : u32; - v697 = arith.eq v685, v701 : i1; - cf.cond_br v697 ^block28, ^block102(v684); + v691 = arith.constant 0 : u32; + v687 = arith.eq v675, v691 : i1; + cf.cond_br v687 ^block28, ^block102(v674); ^block28: ub.unreachable ; - ^block102(v677: i32): - builtin.ret v677; + ^block102(v667: i32): + builtin.ret v667; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -269,7 +269,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no builtin.ret v172; }; - private builtin.function @alloc::vec::Vec::with_capacity(v174: i32) { + 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; @@ -279,21 +279,21 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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; - v720 = arith.constant 16 : i32; + 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/alloc::raw_vec::RawVecInner::with_capacity_in(v185, v720, v720) + 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]; - v719 = arith.constant 8 : u32; - v192 = arith.mod v190, v719 : u32; + 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; - v718 = arith.constant 8 : u32; + v708 = arith.constant 8 : u32; v196 = hir.bitcast v174 : u32; - v198 = arith.add v196, v718 : u32 #[overflow = checked]; + v198 = arith.add v196, v708 : u32 #[overflow = checked]; v199 = arith.constant 4 : u32; v200 = arith.mod v198, v199 : u32; hir.assertz v200 #[code = 250]; @@ -301,20 +301,20 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v201 = hir.int_to_ptr v198 : ptr; hir.store v201, v175; v202 = hir.bitcast v174 : u32; - v717 = arith.constant 4 : u32; - v204 = arith.mod v202, v717 : 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; - v716 = arith.constant 16 : i32; - v207 = arith.add v181, v716 : i32 #[overflow = wrapping]; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v210: i32, v211: i32, v212: i32) { + 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; @@ -328,7 +328,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no 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/alloc::raw_vec::RawVecInner::try_allocate_in(v222, v223, v213, v211, v212) + 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]; @@ -337,604 +337,595 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no hir.assertz v229 #[code = 250]; v230 = hir.int_to_ptr v227 : ptr; v231 = hir.load v230 : i32; - v731 = arith.constant 4 : u32; + v721 = arith.constant 4 : u32; v232 = hir.bitcast v218 : u32; - v234 = arith.add v232, v731 : u32 #[overflow = checked]; - v730 = arith.constant 4 : u32; - v236 = arith.mod v234, v730 : 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; - v729 = arith.constant 0 : 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, v729 : i1; + v244 = arith.neq v242, v719 : i1; cf.cond_br v244 ^block43, ^block44; ^block43: - v258 = arith.constant 12 : u32; - v257 = hir.bitcast v218 : u32; - v259 = arith.add v257, v258 : u32 #[overflow = checked]; - v728 = arith.constant 4 : u32; - v261 = arith.mod v259, v728 : u32; - hir.assertz v261 #[code = 250]; - v262 = hir.int_to_ptr v259 : ptr; - v263 = hir.load v262 : i32; - v727 = arith.constant 4 : u32; - v264 = hir.bitcast v210 : u32; - v266 = arith.add v264, v727 : u32 #[overflow = checked]; - v726 = arith.constant 4 : u32; - v268 = arith.mod v266, v726 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - hir.store v269, v263; - v270 = hir.bitcast v210 : u32; - v725 = arith.constant 4 : u32; - v272 = arith.mod v270, v725 : u32; - hir.assertz v272 #[code = 250]; - v273 = hir.int_to_ptr v270 : ptr; - hir.store v273, v231; - v724 = arith.constant 16 : i32; - v275 = arith.add v218, v724 : i32 #[overflow = wrapping]; - 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; - hir.store v277, v275; + 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; builtin.ret ; ^block44: - v245 = 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 - v246 = hir.bitcast v245 : ptr; - v247 = hir.load v246 : i32; - v723 = arith.constant 12 : u32; - v248 = hir.bitcast v218 : u32; - v250 = arith.add v248, v723 : u32 #[overflow = checked]; - v722 = arith.constant 4 : u32; - v252 = arith.mod v250, v722 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i32; - v255 = arith.constant 1048596 : i32; - v256 = arith.add v247, v255 : 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::raw_vec::handle_error(v231, v254, v256) + 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) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_assets(v278: i32, v279: felt) { - ^block45(v278: i32, v279: felt): + 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; - v283 = hir.load v282 : i32; - v284 = arith.constant 16 : i32; - v285 = arith.sub v283, v284 : i32 #[overflow = wrapping]; - v286 = 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 - v287 = hir.bitcast v286 : ptr; - hir.store v287, v285; - v288 = arith.constant 4 : i32; - v289 = arith.add v285, v288 : 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::vec::Vec::with_capacity(v289) - v293 = arith.constant 8 : u32; - v292 = hir.bitcast v285 : u32; - v294 = arith.add v292, v293 : u32 #[overflow = checked]; - v295 = arith.constant 4 : u32; - v296 = arith.mod v294, v295 : u32; - hir.assertz v296 #[code = 250]; - v297 = hir.int_to_ptr v294 : ptr; - v298 = hir.load v297 : i32; - v732 = arith.constant 2 : u32; - v300 = hir.bitcast v298 : u32; - v302 = arith.shr v300, v732 : u32; - v303 = hir.bitcast v302 : i32; - v304 = 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(v303, v279) : i32 - v290 = arith.constant 8 : i32; - v291 = arith.add v278, v290 : i32 #[overflow = wrapping]; - v305 = hir.bitcast v291 : u32; - v737 = arith.constant 4 : u32; - v307 = arith.mod v305, v737 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - hir.store v308, v304; - v736 = arith.constant 4 : u32; - v309 = hir.bitcast v285 : u32; - v311 = arith.add v309, v736 : u32 #[overflow = checked]; - v735 = arith.constant 4 : u32; - v313 = arith.mod v311, v735 : u32; + 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; - v315 = hir.load v314 : i64; - v316 = hir.bitcast v278 : u32; - v734 = arith.constant 4 : u32; - v318 = arith.mod v316, v734 : u32; - hir.assertz v318 #[code = 250]; - v319 = hir.int_to_ptr v316 : ptr; - hir.store v319, v315; - v733 = arith.constant 16 : i32; - v321 = arith.add v285, v733 : i32 #[overflow = wrapping]; - v322 = 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 - v323 = hir.bitcast v322 : ptr; - hir.store v323, v321; + 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; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v324: i32) -> felt { - ^block47(v324: i32): - v325 = hir.bitcast v324 : felt; - builtin.ret v325; + 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::raw_vec::RawVecInner::deallocate(v327: i32, v328: i32, v329: i32) { - ^block49(v327: i32, v328: i32, v329: i32): - v331 = 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 - v332 = hir.bitcast v331 : ptr; - v333 = hir.load v332 : i32; - v334 = arith.constant 16 : i32; - v335 = arith.sub v333, v334 : i32 #[overflow = wrapping]; - v336 = 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 - v337 = hir.bitcast v336 : ptr; - hir.store v337, v335; - v338 = arith.constant 4 : i32; - v339 = arith.add v335, v338 : 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::raw_vec::RawVecInner::current_memory(v339, v327, v328, v329) - v341 = arith.constant 8 : u32; - v340 = hir.bitcast v335 : u32; - v342 = arith.add v340, v341 : u32 #[overflow = checked]; - v343 = arith.constant 4 : u32; - v344 = arith.mod v342, v343 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - v346 = hir.load v345 : i32; - v744 = arith.constant 0 : i32; - v330 = arith.constant 0 : i32; - v348 = arith.eq v346, v330 : i1; - v349 = arith.zext v348 : u32; - v350 = hir.bitcast v349 : i32; - v352 = arith.neq v350, v744 : i1; - scf.if v352{ + 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 ; + scf.yield v323; } else { ^block52: - v743 = arith.constant 4 : u32; - v353 = hir.bitcast v335 : u32; - v355 = arith.add v353, v743 : u32 #[overflow = checked]; - v742 = arith.constant 4 : u32; - v357 = arith.mod v355, v742 : u32; - hir.assertz v357 #[code = 250]; - v358 = hir.int_to_ptr v355 : ptr; - v359 = hir.load v358 : i32; - v361 = arith.constant 12 : u32; - v360 = hir.bitcast v335 : u32; - v362 = arith.add v360, v361 : u32 #[overflow = checked]; - v741 = arith.constant 4 : u32; - v364 = arith.mod v362, v741 : u32; - hir.assertz v364 #[code = 250]; - v365 = hir.int_to_ptr v362 : ptr; - v366 = hir.load v365 : 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(v359, v346, v366) - scf.yield ; + 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; + } 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; + }; + scf.yield v738; }; - v740 = arith.constant 16 : i32; - v369 = arith.add v335, v740 : i32 #[overflow = wrapping]; - v370 = 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 - v371 = hir.bitcast v370 : ptr; - hir.store v371, v369; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32) { - ^block53(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32): - v379 = 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 - v380 = hir.bitcast v379 : ptr; - v381 = hir.load v380 : i32; - v382 = arith.constant 16 : i32; - v383 = arith.sub v381, v382 : i32 #[overflow = wrapping]; - v384 = 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 - v385 = hir.bitcast v384 : ptr; - hir.store v385, v383; - v395 = hir.bitcast v373 : u32; - v396 = arith.zext v395 : u64; - v397 = hir.bitcast v396 : i64; - v377 = arith.constant 0 : i32; - v390 = arith.sub v377, v375 : i32 #[overflow = wrapping]; - v387 = arith.constant -1 : i32; - v386 = arith.add v375, v376 : i32 #[overflow = wrapping]; - v388 = arith.add v386, v387 : i32 #[overflow = wrapping]; - v391 = arith.band v388, v390 : i32; - v392 = hir.bitcast v391 : u32; - v393 = arith.zext v392 : u64; - v394 = hir.bitcast v393 : i64; - v398 = arith.mul v394, v397 : i64 #[overflow = wrapping]; - v848 = arith.constant 0 : i32; - v399 = arith.constant 32 : i64; - v401 = hir.cast v399 : u32; - v400 = hir.bitcast v398 : u64; - v402 = arith.shr v400, v401 : u64; - v403 = hir.bitcast v402 : i64; - v404 = arith.trunc v403 : i32; - v406 = arith.neq v404, v848 : i1; - v760, v761, v762, v763, v764, v765 = scf.if v406 : i32, i32, i32, i32, i32, u32 { - ^block110: - v745 = arith.constant 0 : u32; - v752 = ub.poison i32 : i32; - scf.yield v372, v383, v752, v752, v752, v745; + 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: + scf.yield ; } else { ^block58: - v407 = arith.trunc v398 : i32; - v847 = arith.constant 0 : i32; - v408 = arith.constant -2147483648 : i32; - v409 = arith.sub v408, v375 : i32 #[overflow = wrapping]; - v411 = hir.bitcast v409 : u32; - v410 = hir.bitcast v407 : u32; - v412 = arith.lte v410, v411 : i1; - v413 = arith.zext v412 : u32; - v414 = hir.bitcast v413 : i32; - v416 = arith.neq v414, v847 : i1; - v808 = scf.if v416 : i32 { - ^block56: - v846 = arith.constant 0 : i32; - v427 = arith.neq v407, v846 : i1; - v807 = scf.if v427 : i32 { - ^block60: - v845 = arith.constant 0 : i32; - v443 = arith.neq v374, v845 : i1; - v806 = scf.if v443 : i32 { - ^block63: - v425 = 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::alloc::Global::alloc_impl(v383, v375, v407, v425) - v454 = hir.bitcast v383 : u32; - v499 = arith.constant 4 : u32; - v456 = arith.mod v454, v499 : u32; - hir.assertz v456 #[code = 250]; - v457 = hir.int_to_ptr v454 : ptr; - v458 = hir.load v457 : i32; - scf.yield v458; - } else { - ^block64: - v444 = arith.constant 8 : i32; - v445 = arith.add v383, v444 : 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(v445, v375, v407) - v429 = arith.constant 8 : u32; - v446 = hir.bitcast v383 : u32; - v448 = arith.add v446, v429 : u32 #[overflow = checked]; - v844 = arith.constant 4 : u32; - v450 = arith.mod v448, v844 : u32; - hir.assertz v450 #[code = 250]; - v451 = hir.int_to_ptr v448 : ptr; - v452 = hir.load v451 : i32; - scf.yield v452; - }; - v842 = arith.constant 0 : i32; - v843 = arith.constant 0 : i32; - v461 = arith.eq v806, v843 : i1; - v462 = arith.zext v461 : u32; - v463 = hir.bitcast v462 : i32; - v465 = arith.neq v463, v842 : i1; - scf.if v465{ - ^block65: - v841 = arith.constant 8 : u32; - v482 = hir.bitcast v372 : u32; - v484 = arith.add v482, v841 : u32 #[overflow = checked]; - v840 = arith.constant 4 : u32; - v486 = arith.mod v484, v840 : u32; - hir.assertz v486 #[code = 250]; - v487 = hir.int_to_ptr v484 : ptr; - hir.store v487, v407; - v839 = arith.constant 4 : u32; - v489 = hir.bitcast v372 : u32; - v491 = arith.add v489, v839 : u32 #[overflow = checked]; - v838 = arith.constant 4 : u32; - v493 = arith.mod v491, v838 : u32; - hir.assertz v493 #[code = 250]; - v494 = hir.int_to_ptr v491 : ptr; - hir.store v494, v375; - scf.yield ; - } else { - ^block66: - v837 = arith.constant 8 : u32; - v467 = hir.bitcast v372 : u32; - v469 = arith.add v467, v837 : u32 #[overflow = checked]; - v836 = arith.constant 4 : u32; - v471 = arith.mod v469, v836 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - hir.store v472, v806; - v835 = arith.constant 4 : u32; - v474 = hir.bitcast v372 : u32; - v476 = arith.add v474, v835 : u32 #[overflow = checked]; - v834 = arith.constant 4 : u32; - v478 = arith.mod v476, v834 : u32; - hir.assertz v478 #[code = 250]; - v479 = hir.int_to_ptr v476 : ptr; - hir.store v479, v373; - scf.yield ; - }; - v832 = arith.constant 0 : i32; - v833 = arith.constant 1 : i32; - v805 = cf.select v465, v833, v832 : i32; - scf.yield v805; - } else { - ^block61: - v831 = arith.constant 8 : u32; - v428 = hir.bitcast v372 : u32; - v430 = arith.add v428, v831 : u32 #[overflow = checked]; - v830 = arith.constant 4 : u32; - v432 = arith.mod v430, v830 : u32; - hir.assertz v432 #[code = 250]; - v433 = hir.int_to_ptr v430 : ptr; - hir.store v433, v375; - v829 = arith.constant 4 : u32; - v436 = hir.bitcast v372 : u32; - v438 = arith.add v436, v829 : u32 #[overflow = checked]; - v828 = arith.constant 4 : u32; - v440 = arith.mod v438, v828 : u32; - hir.assertz v440 #[code = 250]; - v827 = arith.constant 0 : i32; - v441 = hir.int_to_ptr v438 : ptr; - hir.store v441, v827; - v826 = arith.constant 0 : i32; - scf.yield v826; - }; - scf.yield v807; - } else { - ^block59: - v825 = ub.poison i32 : i32; - scf.yield v825; - }; - v820 = arith.constant 0 : u32; - v753 = arith.constant 1 : u32; - v813 = cf.select v416, v753, v820 : u32; - v821 = ub.poison i32 : i32; - v812 = cf.select v416, v383, v821 : i32; - v822 = ub.poison i32 : i32; - v811 = cf.select v416, v372, v822 : i32; - v823 = ub.poison i32 : i32; - v810 = cf.select v416, v823, v383 : i32; - v824 = ub.poison i32 : i32; - v809 = cf.select v416, v824, v372 : i32; - scf.yield v809, v810, v811, v808, v812, v813; - }; - v766, v767, v768 = scf.index_switch v765 : i32, i32, i32 - case 0 { - ^block57: - v819 = arith.constant 4 : u32; - v419 = hir.bitcast v760 : u32; - v421 = arith.add v419, v819 : u32 #[overflow = checked]; - v818 = arith.constant 4 : u32; - v423 = arith.mod v421, v818 : u32; - hir.assertz v423 #[code = 250]; - v817 = arith.constant 0 : i32; - v424 = hir.int_to_ptr v421 : ptr; - hir.store v424, v817; - v816 = arith.constant 1 : i32; - scf.yield v760, v816, v761; - } - default { - ^block114: - scf.yield v762, v763, v764; + 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) + scf.yield ; }; - v498 = hir.bitcast v766 : u32; - v815 = arith.constant 4 : u32; - v500 = arith.mod v498, v815 : u32; - hir.assertz v500 #[code = 250]; - v501 = hir.int_to_ptr v498 : ptr; - hir.store v501, v767; - v814 = arith.constant 16 : i32; - v506 = arith.add v768, v814 : i32 #[overflow = wrapping]; - v507 = 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 - v508 = hir.bitcast v507 : ptr; - hir.store v508, v506; - builtin.ret ; - }; - - private builtin.function @::allocate(v509: i32, v510: i32, v511: i32) { - ^block67(v509: i32, v510: i32, v511: i32): - v513 = 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 - v514 = hir.bitcast v513 : ptr; - v515 = hir.load v514 : i32; - v516 = arith.constant 16 : i32; - v517 = arith.sub v515, v516 : i32 #[overflow = wrapping]; - v518 = 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 - v519 = hir.bitcast v518 : ptr; - hir.store v519, v517; - v512 = arith.constant 0 : i32; - v520 = arith.constant 8 : i32; - v521 = arith.add v517, v520 : 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::alloc::Global::alloc_impl(v521, v510, v511, v512) - v524 = arith.constant 12 : u32; - v523 = hir.bitcast v517 : 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 : i32; - v531 = arith.constant 8 : u32; - v530 = hir.bitcast v517 : u32; - v532 = arith.add v530, v531 : u32 #[overflow = checked]; - v853 = arith.constant 4 : u32; - v534 = arith.mod v532, v853 : u32; - hir.assertz v534 #[code = 250]; - v535 = hir.int_to_ptr v532 : ptr; - v536 = hir.load v535 : i32; - v537 = hir.bitcast v509 : u32; - v852 = arith.constant 4 : u32; - v539 = arith.mod v537, v852 : u32; - hir.assertz v539 #[code = 250]; - v540 = hir.int_to_ptr v537 : ptr; - hir.store v540, v536; - v851 = arith.constant 4 : u32; - v541 = hir.bitcast v509 : u32; - v543 = arith.add v541, v851 : u32 #[overflow = checked]; - v850 = arith.constant 4 : u32; - v545 = arith.mod v543, v850 : u32; - hir.assertz v545 #[code = 250]; - v546 = hir.int_to_ptr v543 : ptr; - hir.store v546, v529; - v849 = arith.constant 16 : i32; - v548 = arith.add v517, v849 : i32 #[overflow = wrapping]; - v549 = 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 - v550 = hir.bitcast v549 : ptr; - hir.store v550, v548; + 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; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v551: i32, v552: i32, v553: i32, v554: i32) { - ^block69(v551: i32, v552: i32, v553: i32, v554: i32): - v869 = arith.constant 0 : i32; - v555 = arith.constant 0 : i32; - v556 = arith.eq v553, v555 : i1; - v557 = arith.zext v556 : u32; - v558 = hir.bitcast v557 : i32; - v560 = arith.neq v558, v869 : i1; - v865 = scf.if v560 : i32 { - ^block117: - scf.yield v552; + 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; } else { - ^block72: - 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() - v868 = arith.constant 0 : i32; - v562 = arith.neq v554, v868 : i1; - v864 = scf.if v562 : i32 { - ^block73: - v564 = 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(v553, v552) : i32 - scf.yield v564; + ^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; } else { - ^block74: - v563 = 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(v553, v552) : i32 - scf.yield v563; + ^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; }; - scf.yield v864; + v436 = arith.constant 8 : i32; + v766 = arith.constant 4 : i32; + v762 = cf.select v417, v766, v436 : i32; + scf.yield v762, v761; }; - v568 = arith.constant 4 : u32; - v567 = hir.bitcast v551 : u32; - v569 = arith.add v567, v568 : u32 #[overflow = checked]; - v867 = arith.constant 4 : u32; - v571 = arith.mod v569, v867 : u32; - hir.assertz v571 #[code = 250]; - v572 = hir.int_to_ptr v569 : ptr; - hir.store v572, v553; - v574 = hir.bitcast v551 : u32; - v866 = arith.constant 4 : u32; - v576 = arith.mod v574, v866 : u32; - hir.assertz v576 #[code = 250]; - v577 = hir.int_to_ptr v574 : ptr; - hir.store v577, v865; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v578: i32, v579: i32, v580: i32, v581: i32) { - ^block75(v578: i32, v579: i32, v580: i32, v581: i32): - v895 = arith.constant 0 : i32; - v582 = arith.constant 0 : i32; - v586 = arith.eq v581, v582 : i1; - v587 = arith.zext v586 : u32; - v588 = hir.bitcast v587 : i32; - v590 = arith.neq v588, v895 : i1; - v882, v883 = scf.if v590 : i32, i32 { - ^block121: - v894 = arith.constant 0 : i32; - v584 = arith.constant 4 : i32; - scf.yield v584, v894; + 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: + scf.yield ; } else { - ^block78: - v591 = hir.bitcast v579 : u32; - v626 = arith.constant 4 : u32; - v593 = arith.mod v591, v626 : u32; - hir.assertz v593 #[code = 250]; - v594 = hir.int_to_ptr v591 : ptr; - v595 = hir.load v594 : i32; - v892 = arith.constant 0 : i32; - v893 = arith.constant 0 : i32; - v597 = arith.eq v595, v893 : i1; - v598 = arith.zext v597 : u32; - v599 = hir.bitcast v598 : i32; - v601 = arith.neq v599, v892 : i1; - v880 = scf.if v601 : i32 { - ^block120: - v891 = arith.constant 0 : i32; - scf.yield v891; - } else { - ^block79: - v890 = arith.constant 4 : u32; - v602 = hir.bitcast v578 : u32; - v604 = arith.add v602, v890 : u32 #[overflow = checked]; - v889 = arith.constant 4 : u32; - v606 = arith.mod v604, v889 : u32; - hir.assertz v606 #[code = 250]; - v607 = hir.int_to_ptr v604 : ptr; - hir.store v607, v580; - v888 = arith.constant 4 : u32; - v608 = hir.bitcast v579 : u32; - v610 = arith.add v608, v888 : u32 #[overflow = checked]; - v887 = arith.constant 4 : u32; - v612 = arith.mod v610, v887 : u32; - hir.assertz v612 #[code = 250]; - v613 = hir.int_to_ptr v610 : ptr; - v614 = hir.load v613 : i32; - v615 = hir.bitcast v578 : u32; - v886 = arith.constant 4 : u32; - v617 = arith.mod v615, v886 : u32; - hir.assertz v617 #[code = 250]; - v618 = hir.int_to_ptr v615 : ptr; - hir.store v618, v614; - v619 = arith.mul v595, v581 : i32 #[overflow = wrapping]; - scf.yield v619; - }; - v620 = arith.constant 8 : i32; - v885 = arith.constant 4 : i32; - v881 = cf.select v601, v885, v620 : i32; - scf.yield v881, v880; + ^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) + scf.yield ; }; - v623 = arith.add v578, v882 : i32 #[overflow = wrapping]; - v625 = hir.bitcast v623 : u32; - v884 = arith.constant 4 : u32; - v627 = arith.mod v625, v884 : u32; - hir.assertz v627 #[code = 250]; - v628 = hir.int_to_ptr v625 : ptr; - hir.store v628, v883; builtin.ret ; }; - private builtin.function @::deallocate(v629: i32, v630: i32, v631: i32) { - ^block80(v629: i32, v630: i32, v631: i32): - v897 = arith.constant 0 : i32; - v632 = arith.constant 0 : i32; - v633 = arith.eq v631, v632 : i1; - v634 = arith.zext v633 : u32; - v635 = hir.bitcast v634 : i32; - v637 = arith.neq v635, v897 : i1; - scf.if v637{ - ^block82: - scf.yield ; + 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; + 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; } else { - ^block83: - 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(v629, v631, v630) - scf.yield ; + ^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; + } 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; + }; + 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; + 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; + scf.yield ; + }; + v871 = arith.constant 1 : i32; + v872 = arith.constant 0 : i32; + v844 = cf.select v585, v872, v871 : i32; + scf.yield v844; + } 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; + }; + scf.yield v846; + } else { + ^block76: + v864 = ub.poison i32 : i32; + scf.yield v864; + }; + 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; + }; + v805, v806, v807 = scf.index_switch v804 : i32, i32, i32 + 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; + } + default { + ^block122: + scf.yield v801, v802, v803; }; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v638: i32, v639: i32, v640: i32) { - ^block84(v638: i32, v639: i32, v640: i32): + private builtin.function @alloc::raw_vec::handle_error(v629: i32, v630: i32) { + ^block84(v629: i32, v630: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v641: i32, v642: i32) -> i32 { - ^block86(v641: i32, v642: i32): - v649 = arith.constant 0 : i32; - v645 = hir.bitcast v642 : u32; - v644 = hir.bitcast v641 : u32; - v646 = arith.gt v644, v645 : i1; - v647 = arith.zext v646 : u32; - v648 = hir.bitcast v647 : i32; - v650 = arith.neq v648, v649 : i1; - v651 = cf.select v650, v641, v642 : i32; - builtin.ret v651; + 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 @miden::input_note::get_assets(v652: i32, v653: felt) -> i32 { - ^block88(v652: i32, v653: felt): - v654, v655 = hir.exec @miden/input_note/get_assets(v652, v653) : i32, i32 - builtin.ret v654; + 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; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -945,14 +936,12 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x003e64657463616465723c; - - builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; + builtin.segment @1048576 = 0x0000000100000001; }; public builtin.function @binding() -> felt { ^block92: - v657 = 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 v657; + 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; }; }; \ 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 e62fa61e7..472f7f025 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 @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] adv.push_mapval push.262144 - push.3 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + 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 @@ -45,7 +45,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -53,7 +53,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048612 + push.1048584 u32wrapping_add movup.2 swap.1 @@ -73,7 +73,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -81,7 +81,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048612 + push.1048584 u32wrapping_add dup.1 swap.2 @@ -167,7 +167,7 @@ end proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding( ) -> felt - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -177,7 +177,7 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -237,13 +237,13 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets 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::RawVecInner::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 push.16 movup.2 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -264,7 +264,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -272,7 +272,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048616 + push.1048588 u32wrapping_add u32divmod.4 swap.1 @@ -293,7 +293,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -307,7 +307,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048616 + push.1048588 movup.2 u32wrapping_add u32divmod.4 @@ -365,7 +365,7 @@ proc ::alloc( movup.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::core::ptr::alignment::Alignment::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 push.0 @@ -526,8 +526,10 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc alloc::vec::Vec::with_capacity(i32) - push.1114176 +proc >::with_capacity( + i32 +) + push.1114144 u32divmod.4 swap.1 trace.240 @@ -537,7 +539,7 @@ proc alloc::vec::Vec::with_capacity(i32) nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -556,7 +558,7 @@ proc alloc::vec::Vec::with_capacity(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::raw_vec::RawVecInner::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 push.8 @@ -614,7 +616,7 @@ proc alloc::vec::Vec::with_capacity(i32) nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -625,12 +627,12 @@ proc alloc::vec::Vec::with_capacity(i32) end @callconv("C") -proc alloc::raw_vec::RawVecInner::with_capacity_in( +proc ::with_capacity_in( i32, i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -640,7 +642,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -663,7 +665,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( movdn.3 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::RawVecInner::try_allocate_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::::try_allocate_in trace.252 nop push.8 @@ -756,7 +758,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -767,16 +769,8 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( else movup.2 drop - push.1114180 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.12 - movup.3 + movup.2 add u32assert push.4 @@ -792,10 +786,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048596 - movup.2 - u32wrapping_add - 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::alloc::raw_vec::handle_error @@ -811,7 +802,7 @@ proc miden_base_sys::bindings::input_note::get_assets( i32, felt ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -821,7 +812,7 @@ proc miden_base_sys::bindings::input_note::get_assets( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -836,7 +827,7 @@ proc miden_base_sys::bindings::input_note::get_assets( 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::alloc::vec::Vec::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 push.8 @@ -919,7 +910,7 @@ proc miden_base_sys::bindings::input_note::get_assets( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -935,12 +926,90 @@ proc intrinsics::felt::from_u32(i32) -> felt end @callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +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.::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 + push.0 + movup.4 + neq + if.true + 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 + trace.252 + nop + else + 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 + 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.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -950,7 +1019,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -970,7 +1039,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( 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::RawVecInner::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 push.8 @@ -1041,7 +1110,139 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114176 + 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 @@ -1052,14 +1253,38 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( +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.::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 + +@callconv("C") +proc ::allocate( i32, i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1069,7 +1294,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1079,14 +1304,135 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 push.0 - push.0 - dup.7 - u32wrapping_sub - push.4294967295 - movup.9 - dup.9 + push.8 + dup.2 + 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 + 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 @@ -1163,7 +1509,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( 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::alloc::Global::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 dup.2 @@ -1211,14 +1557,12 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop end push.0 - push.0 - dup.2 - eq + dup.1 neq dup.0 if.true - movup.6 - movup.2 + movup.7 + movup.4 drop drop push.8 @@ -1231,7 +1575,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.3 + movup.2 swap.1 u32divmod.4 swap.1 @@ -1260,8 +1604,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop else - movup.7 - movup.4 + movup.6 + movup.2 drop drop push.8 @@ -1274,7 +1618,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.2 + movup.3 swap.1 u32divmod.4 swap.1 @@ -1303,8 +1647,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop end - push.0 push.1 + push.0 movup.2 cdrop else @@ -1454,7 +1798,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1465,363 +1809,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( end @callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114176 - 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.::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::alloc::Global::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.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::Global::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.::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 - push.0 - movup.4 - neq - if.true - 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 - trace.252 - nop - else - 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 - 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 alloc::raw_vec::RawVecInner::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.::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 - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop +proc alloc::raw_vec::handle_error(i32, i32) drop drop push.0 @@ -1829,7 +1817,10 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) end @callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 +proc ::max( + i32, + i32 +) -> i32 push.0 dup.2 dup.2 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 ebdf3dafe..cdbae458c 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 (param i32 i32) (result i32))) (type (;2;) (func (param i32 i32 i32))) @@ -16,9 +16,10 @@ (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 i32))) - (type (;10;) (func (param i32 i32 i32 i32))) - (type (;11;) (func (param i32 f32) (result i32))) + (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 f32) (result i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -29,7 +30,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048612 + i32.const 1048584 i32.add local.get 1 local.get 0 @@ -39,7 +40,7 @@ (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 1048612 + i32.const 1048584 i32.add local.get 1 local.get 0 @@ -81,7 +82,7 @@ i32.add i32.const 16 i32.const 16 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 0 i32.const 16 i32.add @@ -95,7 +96,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048616 + i32.const 1048588 i32.add i32.load8_u br_if 0 (;@1;) @@ -103,7 +104,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048616 + i32.const 1048588 i32.add i32.const 1 i32.store8 @@ -128,7 +129,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -184,7 +185,7 @@ (func $intrinsics::mem::heap_base (;9;) (type 5) (result i32) unreachable ) - (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32) + (func $>::with_capacity (;10;) (type 6) (param i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -196,7 +197,7 @@ i32.add i32.const 16 i32.const 16 - call $alloc::raw_vec::RawVecInner::with_capacity_in + call $::with_capacity_in local.get 1 i64.load offset=8 local.set 2 @@ -211,7 +212,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 2) (param i32 i32 i32) + (func $::with_capacity_in (;11;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -225,7 +226,7 @@ i32.const 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::try_allocate_in + call $::try_allocate_in local.get 3 i32.load offset=8 local.set 2 @@ -235,14 +236,9 @@ i32.const 1 i32.ne br_if 0 (;@1;) - global.get $GOT.data.internal.__memory_base - local.set 0 local.get 2 local.get 3 i32.load offset=12 - local.get 0 - i32.const 1048596 - i32.add call $alloc::raw_vec::handle_error unreachable end @@ -268,7 +264,7 @@ local.get 2 i32.const 4 i32.add - call $alloc::vec::Vec::with_capacity + call $>::with_capacity local.get 0 i32.const 8 i32.add @@ -291,7 +287,34 @@ (func $intrinsics::felt::from_u32 (;13;) (type 8) (param i32) (result f32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;14;) (type 2) (param i32 i32 i32) + (func $::alloc_impl (;14;) (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 (;15;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -304,7 +327,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -323,7 +346,82 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 9) (param i32 i32 i32 i32 i32) + (func $::current_memory (;16;) (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 (;17;) (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 (;18;) (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 (;19;) (type 10) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -399,32 +497,31 @@ local.get 3 local.get 4 i32.const 1 - call $alloc::alloc::Global::alloc_impl + call $::alloc_impl local.get 5 i32.load local.set 2 end block ;; label = @2 local.get 2 - i32.eqz br_if 0 (;@2;) local.get 0 - local.get 2 + local.get 4 i32.store offset=8 local.get 0 - local.get 1 + local.get 3 i32.store offset=4 - i32.const 0 + i32.const 1 local.set 3 br 1 (;@1;) end local.get 0 - local.get 4 + local.get 2 i32.store offset=8 local.get 0 - local.get 3 + local.get 1 i32.store offset=4 - i32.const 1 + i32.const 0 local.set 3 end local.get 0 @@ -435,112 +532,10 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;16;) (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::alloc::Global::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 $alloc::alloc::Global::alloc_impl (;17;) (type 10) (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 $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 10) (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 (;19;) (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 $alloc::raw_vec::handle_error (;20;) (type 2) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;20;) (type 11) (param i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;21;) (type 1) (param i32 i32) (result i32) + (func $::max (;21;) (type 1) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -548,21 +543,20 @@ i32.gt_u select ) - (func $miden::input_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) + (func $miden::input_note::get_assets (;22;) (type 12) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "\00") - (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") + (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-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-input-note-get-assets-binding/rust-sdk-input-note-get-assets-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))) @@ -572,11 +566,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-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 (;2;) "miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1-shim-instance)) ) 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 e11456059..5eb18c37c 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 @@ -125,7 +125,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v46, v88) + 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]; @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v99: i32, v100: i32) { + 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; 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 71d197d8d..86428a52d 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 @@ -321,7 +321,7 @@ proc miden_base_sys::bindings::input_note::get_assets_info( 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 @@ -354,7 +354,7 @@ proc miden_base_sys::bindings::input_note::get_assets_info( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 0d99037ff..ae7ede13c 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32 f32))) @@ -86,7 +86,7 @@ local.get 2 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 0 local.get 1 f32.store offset=16 @@ -95,7 +95,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -162,14 +162,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-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-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-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))) @@ -179,11 +179,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-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 (;2;) "miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1-shim-instance)) ) 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 580049f39..bfa3f2b1a 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 @@ -125,7 +125,7 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v46, v88) + 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]; @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v99: i32, v100: i32) { + 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; 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 26efc0b53..ecfde15bd 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 @@ -321,7 +321,7 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 @@ -354,7 +354,7 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 b196d2c13..58077fe9e 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32 f32))) @@ -86,7 +86,7 @@ local.get 2 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 0 local.get 1 f32.store offset=16 @@ -95,7 +95,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -162,14 +162,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-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-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-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))) @@ -179,11 +179,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-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 (;2;) "miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1-shim-instance)) ) 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 a0da29f51..17ba29fa9 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 @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + 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 @@ -151,7 +151,7 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + 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; 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 4503c561e..3bb690f4d 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 @@ -417,7 +417,7 @@ proc miden_base_sys::bindings::input_note::get_metadata( 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 @@ -433,7 +433,7 @@ proc miden_base_sys::bindings::input_note::get_metadata( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 141cba7d0..3650b1cac 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -94,13 +94,13 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -167,15 +167,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -188,12 +188,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1-shim-instance)) ) 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 73dab4998..aa052b0f2 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 @@ -144,7 +144,7 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v101, v103) + 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]; @@ -199,7 +199,7 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v144: i32, v145: i32) { + 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; 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 617cfb6ef..894b43836 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 @@ -422,7 +422,7 @@ proc miden_base_sys::bindings::input_note::get_recipient( 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::miden_stdlib_sys::intrinsics::word::Word::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::::reverse trace.252 nop push.40 @@ -555,7 +555,7 @@ proc miden_base_sys::bindings::input_note::get_recipient( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 04a47d9d9..c83459b8f 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "recipient" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -98,7 +98,7 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 local.get 2 i64.load offset=40 @@ -122,7 +122,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -189,16 +189,16 @@ (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") ) - (alias export 0 "recipient" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "recipient" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "recipient" (type $recipient (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $recipient))) + (alias core export $main "miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "recipient" (type $"#type5 recipient" (@name "recipient") (;5;))) + (component $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -213,13 +213,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-recipient" (type 5)) - (with "import-type-recipient0" (type 1)) + (instance $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-recipient" (type $"#type5 recipient")) + (with "import-type-recipient0" (type $recipient)) ) ) - (export (;2;) "miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1-shim-instance)) ) 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 cbeabd23f..cc201cb1a 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 @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + 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 @@ -151,7 +151,7 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + 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; 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 bc29094d2..ae4df808d 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 @@ -417,7 +417,7 @@ proc miden_base_sys::bindings::input_note::get_script_root( 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::miden_stdlib_sys::intrinsics::word::Word::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::::reverse trace.252 nop push.32 @@ -433,7 +433,7 @@ proc miden_base_sys::bindings::input_note::get_script_root( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 4bb7ebd2e..3e1dcf1f1 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -94,13 +94,13 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -167,15 +167,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -188,12 +188,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1-shim-instance)) ) 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 67fb8667a..0cc575447 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -7,8 +7,8 @@ (export (;3;) "account-id" (type (eq 2))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -98,15 +98,15 @@ (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") ) - (alias export 0 "account-id" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "account-id" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "account-id" (type $account-id (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $account-id))) + (alias core export $main "miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "account-id" (type $"#type4 account-id" (@name "account-id") (;4;))) + (component $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (record (field "prefix" 1) (field "suffix" 1))) @@ -118,12 +118,12 @@ (type (;7;) (func (result 6))) (export (;1;) "binding" (func 0) (func (type 7))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-account-id" (type 4)) - (with "import-type-account-id0" (type 1)) + (instance $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-account-id" (type $"#type4 account-id")) + (with "import-type-account-id0" (type $account-id)) ) ) - (export (;2;) "miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1-shim-instance)) ) 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 674511820..650d6f9ef 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 @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + 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 @@ -151,7 +151,7 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + 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; 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 8c378634a..c7a8e806a 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 @@ -417,7 +417,7 @@ proc miden_base_sys::bindings::input_note::get_serial_number( 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::miden_stdlib_sys::intrinsics::word::Word::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::::reverse trace.252 nop push.32 @@ -433,7 +433,7 @@ proc miden_base_sys::bindings::input_note::get_serial_number( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 150d7536e..7b8a4efbf 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -94,13 +94,13 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -167,15 +167,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding" (core func $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -188,12 +188,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1 (;2;) "miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1" (instance $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1-shim-instance)) ) 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 fac0feec8..fdd46dd4d 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param f32 f32 f32 f32))) (table (;0;) 2 2 funcref) @@ -48,15 +48,15 @@ ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/note-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -69,12 +69,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/note-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/note-script@1.0.0" (instance 1)) + (export $miden:base/note-script@1.0.0 (;2;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) 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 14970b441..36da73908 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32 f32))) @@ -122,14 +122,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-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-add-asset-binding/rust-sdk-output-note-add-asset-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))) @@ -139,11 +139,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-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 (;2;) "miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1" (instance $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1-shim-instance)) ) 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 9146ec403..c0e8a0403 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -7,8 +7,8 @@ (export (;3;) "note-idx" (type (eq 2))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 f32 i32) (result f32))) @@ -135,15 +135,15 @@ (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") ) - (alias export 0 "note-idx" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "note-idx" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "note-idx" (type $note-idx (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $note-idx))) + (alias core export $main "miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "note-idx" (type $"#type4 note-idx" (@name "note-idx") (;4;))) + (component $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (record (field "inner" 1))) @@ -155,12 +155,12 @@ (type (;7;) (func (result 6))) (export (;1;) "binding" (func 0) (func (type 7))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-note-idx" (type 4)) - (with "import-type-note-idx0" (type 1)) + (instance $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-note-idx" (type $"#type4 note-idx")) + (with "import-type-note-idx0" (type $note-idx)) ) ) - (export (;2;) "miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1" (instance $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1-shim-instance)) ) 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 9531a3cae..180891820 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,7 +10,7 @@ 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 1048612 : 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; @@ -26,36 +26,36 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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 1048612 : 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 - v666 = arith.constant 0 : 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, v666 : i1; + v26 = arith.neq v24, v656 : i1; scf.if v26{ ^block13: scf.yield ; } else { ^block14: - v664 = arith.constant 0 : i32; - v665 = arith.constant 0 : i32; - v28 = arith.eq v12, v665 : i1; + 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, v664 : i1; + v32 = arith.neq v30, v654 : i1; scf.if v32{ ^block94: scf.yield ; } else { ^block15: - v658 = arith.constant 0 : u8; + 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, v658; + hir.mem_set v37, v35, v648; scf.yield ; }; scf.yield ; @@ -93,12 +93,12 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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 - v668 = arith.constant 16 : i32; - v669 = arith.constant 4 : i32; - v62 = arith.add v46, v669 : 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::raw_vec::RawVecInner::deallocate(v62, v668, v668) - v667 = arith.constant 16 : i32; - v66 = arith.add v46, v667 : i32 #[overflow = wrapping]; + 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; @@ -115,7 +115,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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 1048616 : 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; @@ -133,12 +133,12 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v83 = hir.bitcast v82 : ptr; v84 = hir.load v83 : 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/__wasm_call_ctors() - v671 = arith.constant 1 : u8; - v673 = arith.constant 1048616 : i32; - v86 = arith.add v84, v673 : i32 #[overflow = wrapping]; + 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, v671; + hir.store v91, v661; scf.yield ; }; builtin.ret ; @@ -148,27 +148,27 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- ^block26(v92: i32, v93: i32, v94: i32): v97 = arith.constant 16 : i32; v96 = arith.constant 0 : i32; - v675 = arith.constant 16 : u32; + v665 = arith.constant 16 : u32; v99 = hir.bitcast v93 : u32; - v101 = arith.gt v99, v675 : i1; + 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; - v715 = arith.constant 0 : 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, v715 : i1; - v684, v685 = scf.if v111 : i32, u32 { + v111 = arith.neq v109, v705 : i1; + v674, v675 = scf.if v111 : i32, u32 { ^block100: - v676 = arith.constant 0 : u32; - v680 = ub.poison i32 : i32; - scf.yield v680, v676; + v666 = arith.constant 0 : u32; + v670 = ub.poison i32 : i32; + scf.yield v670, v666; } 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/core::ptr::alignment::Alignment::max(v93, v106) : i32 - v714 = arith.constant 0 : i32; + 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; @@ -176,18 +176,18 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v117 = arith.gt v115, v116 : i1; v118 = arith.zext v117 : u32; v119 = hir.bitcast v118 : i32; - v121 = arith.neq v119, v714 : i1; - v699 = scf.if v121 : i32 { + v121 = arith.neq v119, v704 : i1; + v689 = scf.if v121 : i32 { ^block99: - v713 = ub.poison i32 : i32; - scf.yield v713; + v703 = ub.poison i32 : i32; + scf.yield v703; } else { ^block30: - v711 = arith.constant 0 : i32; - v127 = arith.sub v711, v113 : i32 #[overflow = wrapping]; - v712 = arith.constant -1 : i32; + 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, v712 : 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; @@ -195,8 +195,8 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- hir.assertz v131 #[code = 250]; v132 = hir.int_to_ptr v129 : ptr; v133 = hir.load v132 : i32; - v710 = arith.constant 0 : i32; - v135 = arith.neq v133, v710 : i1; + v700 = arith.constant 0 : i32; + v135 = arith.neq v133, v700 : i1; scf.if v135{ ^block98: scf.yield ; @@ -205,41 +205,41 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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; - v709 = arith.constant 4 : u32; - v145 = arith.mod v143, v709 : u32; + v699 = arith.constant 4 : u32; + v145 = arith.mod v143, v699 : u32; hir.assertz v145 #[code = 250]; - v708 = arith.constant 16 : u32; + v698 = arith.constant 16 : u32; v138 = hir.bitcast v137 : i32; - v141 = arith.shl v138, v708 : 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; scf.yield ; }; v149 = hir.bitcast v92 : u32; - v707 = arith.constant 4 : u32; - v151 = arith.mod v149, v707 : 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; - v705 = arith.constant 0 : i32; - v706 = arith.constant -1 : i32; - v155 = arith.bxor v153, v706 : 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, v705 : i1; - v698 = scf.if v162 : i32 { + v162 = arith.neq v160, v695 : i1; + v688 = scf.if v162 : i32 { ^block33: - v704 = arith.constant 0 : i32; - scf.yield v704; + v694 = arith.constant 0 : i32; + scf.yield v694; } else { ^block34: v164 = hir.bitcast v92 : u32; - v703 = arith.constant 4 : u32; - v166 = arith.mod v164, v703 : 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; @@ -247,20 +247,20 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; scf.yield v169; }; - scf.yield v698; + scf.yield v688; }; - v681 = arith.constant 1 : u32; - v702 = arith.constant 0 : u32; - v700 = cf.select v121, v702, v681 : u32; - scf.yield v699, v700; + v671 = arith.constant 1 : u32; + v692 = arith.constant 0 : u32; + v690 = cf.select v121, v692, v671 : u32; + scf.yield v689, v690; }; - v701 = arith.constant 0 : u32; - v697 = arith.eq v685, v701 : i1; - cf.cond_br v697 ^block28, ^block102(v684); + v691 = arith.constant 0 : u32; + v687 = arith.eq v675, v691 : i1; + cf.cond_br v687 ^block28, ^block102(v674); ^block28: ub.unreachable ; - ^block102(v677: i32): - builtin.ret v677; + ^block102(v667: i32): + builtin.ret v667; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -269,7 +269,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- builtin.ret v172; }; - private builtin.function @alloc::vec::Vec::with_capacity(v174: i32) { + 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; @@ -279,21 +279,21 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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; - v720 = arith.constant 16 : i32; + 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/alloc::raw_vec::RawVecInner::with_capacity_in(v185, v720, v720) + 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]; - v719 = arith.constant 8 : u32; - v192 = arith.mod v190, v719 : u32; + 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; - v718 = arith.constant 8 : u32; + v708 = arith.constant 8 : u32; v196 = hir.bitcast v174 : u32; - v198 = arith.add v196, v718 : u32 #[overflow = checked]; + v198 = arith.add v196, v708 : u32 #[overflow = checked]; v199 = arith.constant 4 : u32; v200 = arith.mod v198, v199 : u32; hir.assertz v200 #[code = 250]; @@ -301,20 +301,20 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v201 = hir.int_to_ptr v198 : ptr; hir.store v201, v175; v202 = hir.bitcast v174 : u32; - v717 = arith.constant 4 : u32; - v204 = arith.mod v202, v717 : 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; - v716 = arith.constant 16 : i32; - v207 = arith.add v181, v716 : i32 #[overflow = wrapping]; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v210: i32, v211: i32, v212: i32) { + 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; @@ -328,7 +328,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- 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/alloc::raw_vec::RawVecInner::try_allocate_in(v222, v223, v213, v211, v212) + 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]; @@ -337,604 +337,595 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- hir.assertz v229 #[code = 250]; v230 = hir.int_to_ptr v227 : ptr; v231 = hir.load v230 : i32; - v731 = arith.constant 4 : u32; + v721 = arith.constant 4 : u32; v232 = hir.bitcast v218 : u32; - v234 = arith.add v232, v731 : u32 #[overflow = checked]; - v730 = arith.constant 4 : u32; - v236 = arith.mod v234, v730 : 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; - v729 = arith.constant 0 : 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, v729 : i1; + v244 = arith.neq v242, v719 : i1; cf.cond_br v244 ^block43, ^block44; ^block43: - v258 = arith.constant 12 : u32; - v257 = hir.bitcast v218 : u32; - v259 = arith.add v257, v258 : u32 #[overflow = checked]; - v728 = arith.constant 4 : u32; - v261 = arith.mod v259, v728 : u32; - hir.assertz v261 #[code = 250]; - v262 = hir.int_to_ptr v259 : ptr; - v263 = hir.load v262 : i32; - v727 = arith.constant 4 : u32; - v264 = hir.bitcast v210 : u32; - v266 = arith.add v264, v727 : u32 #[overflow = checked]; - v726 = arith.constant 4 : u32; - v268 = arith.mod v266, v726 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - hir.store v269, v263; - v270 = hir.bitcast v210 : u32; - v725 = arith.constant 4 : u32; - v272 = arith.mod v270, v725 : u32; - hir.assertz v272 #[code = 250]; - v273 = hir.int_to_ptr v270 : ptr; - hir.store v273, v231; - v724 = arith.constant 16 : i32; - v275 = arith.add v218, v724 : i32 #[overflow = wrapping]; - 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; - hir.store v277, v275; + 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; builtin.ret ; ^block44: - v245 = 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 - v246 = hir.bitcast v245 : ptr; - v247 = hir.load v246 : i32; - v723 = arith.constant 12 : u32; - v248 = hir.bitcast v218 : u32; - v250 = arith.add v248, v723 : u32 #[overflow = checked]; - v722 = arith.constant 4 : u32; - v252 = arith.mod v250, v722 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i32; - v255 = arith.constant 1048596 : i32; - v256 = arith.add v247, v255 : 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::raw_vec::handle_error(v231, v254, v256) + 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) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::output_note::get_assets(v278: i32, v279: felt) { - ^block45(v278: i32, v279: felt): + 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; - v283 = hir.load v282 : i32; - v284 = arith.constant 16 : i32; - v285 = arith.sub v283, v284 : i32 #[overflow = wrapping]; - v286 = 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 - v287 = hir.bitcast v286 : ptr; - hir.store v287, v285; - v288 = arith.constant 4 : i32; - v289 = arith.add v285, v288 : 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::vec::Vec::with_capacity(v289) - v293 = arith.constant 8 : u32; - v292 = hir.bitcast v285 : u32; - v294 = arith.add v292, v293 : u32 #[overflow = checked]; - v295 = arith.constant 4 : u32; - v296 = arith.mod v294, v295 : u32; - hir.assertz v296 #[code = 250]; - v297 = hir.int_to_ptr v294 : ptr; - v298 = hir.load v297 : i32; - v732 = arith.constant 2 : u32; - v300 = hir.bitcast v298 : u32; - v302 = arith.shr v300, v732 : u32; - v303 = hir.bitcast v302 : i32; - v304 = 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(v303, v279) : i32 - v290 = arith.constant 8 : i32; - v291 = arith.add v278, v290 : i32 #[overflow = wrapping]; - v305 = hir.bitcast v291 : u32; - v737 = arith.constant 4 : u32; - v307 = arith.mod v305, v737 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - hir.store v308, v304; - v736 = arith.constant 4 : u32; - v309 = hir.bitcast v285 : u32; - v311 = arith.add v309, v736 : u32 #[overflow = checked]; - v735 = arith.constant 4 : u32; - v313 = arith.mod v311, v735 : u32; + 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; - v315 = hir.load v314 : i64; - v316 = hir.bitcast v278 : u32; - v734 = arith.constant 4 : u32; - v318 = arith.mod v316, v734 : u32; - hir.assertz v318 #[code = 250]; - v319 = hir.int_to_ptr v316 : ptr; - hir.store v319, v315; - v733 = arith.constant 16 : i32; - v321 = arith.add v285, v733 : i32 #[overflow = wrapping]; - v322 = 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 - v323 = hir.bitcast v322 : ptr; - hir.store v323, v321; + 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; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v324: i32) -> felt { - ^block47(v324: i32): - v325 = hir.bitcast v324 : felt; - builtin.ret v325; + 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::raw_vec::RawVecInner::deallocate(v327: i32, v328: i32, v329: i32) { - ^block49(v327: i32, v328: i32, v329: i32): - v331 = 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 - v332 = hir.bitcast v331 : ptr; - v333 = hir.load v332 : i32; - v334 = arith.constant 16 : i32; - v335 = arith.sub v333, v334 : i32 #[overflow = wrapping]; - v336 = 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 - v337 = hir.bitcast v336 : ptr; - hir.store v337, v335; - v338 = arith.constant 4 : i32; - v339 = arith.add v335, v338 : 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::raw_vec::RawVecInner::current_memory(v339, v327, v328, v329) - v341 = arith.constant 8 : u32; - v340 = hir.bitcast v335 : u32; - v342 = arith.add v340, v341 : u32 #[overflow = checked]; - v343 = arith.constant 4 : u32; - v344 = arith.mod v342, v343 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - v346 = hir.load v345 : i32; - v744 = arith.constant 0 : i32; - v330 = arith.constant 0 : i32; - v348 = arith.eq v346, v330 : i1; - v349 = arith.zext v348 : u32; - v350 = hir.bitcast v349 : i32; - v352 = arith.neq v350, v744 : i1; - scf.if v352{ + 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 ; + scf.yield v323; } else { ^block52: - v743 = arith.constant 4 : u32; - v353 = hir.bitcast v335 : u32; - v355 = arith.add v353, v743 : u32 #[overflow = checked]; - v742 = arith.constant 4 : u32; - v357 = arith.mod v355, v742 : u32; - hir.assertz v357 #[code = 250]; - v358 = hir.int_to_ptr v355 : ptr; - v359 = hir.load v358 : i32; - v361 = arith.constant 12 : u32; - v360 = hir.bitcast v335 : u32; - v362 = arith.add v360, v361 : u32 #[overflow = checked]; - v741 = arith.constant 4 : u32; - v364 = arith.mod v362, v741 : u32; - hir.assertz v364 #[code = 250]; - v365 = hir.int_to_ptr v362 : ptr; - v366 = hir.load v365 : 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(v359, v346, v366) - scf.yield ; + 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; + } 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; + }; + scf.yield v738; }; - v740 = arith.constant 16 : i32; - v369 = arith.add v335, v740 : i32 #[overflow = wrapping]; - v370 = 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 - v371 = hir.bitcast v370 : ptr; - hir.store v371, v369; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32) { - ^block53(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32): - v379 = 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 - v380 = hir.bitcast v379 : ptr; - v381 = hir.load v380 : i32; - v382 = arith.constant 16 : i32; - v383 = arith.sub v381, v382 : i32 #[overflow = wrapping]; - v384 = 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 - v385 = hir.bitcast v384 : ptr; - hir.store v385, v383; - v395 = hir.bitcast v373 : u32; - v396 = arith.zext v395 : u64; - v397 = hir.bitcast v396 : i64; - v377 = arith.constant 0 : i32; - v390 = arith.sub v377, v375 : i32 #[overflow = wrapping]; - v387 = arith.constant -1 : i32; - v386 = arith.add v375, v376 : i32 #[overflow = wrapping]; - v388 = arith.add v386, v387 : i32 #[overflow = wrapping]; - v391 = arith.band v388, v390 : i32; - v392 = hir.bitcast v391 : u32; - v393 = arith.zext v392 : u64; - v394 = hir.bitcast v393 : i64; - v398 = arith.mul v394, v397 : i64 #[overflow = wrapping]; - v848 = arith.constant 0 : i32; - v399 = arith.constant 32 : i64; - v401 = hir.cast v399 : u32; - v400 = hir.bitcast v398 : u64; - v402 = arith.shr v400, v401 : u64; - v403 = hir.bitcast v402 : i64; - v404 = arith.trunc v403 : i32; - v406 = arith.neq v404, v848 : i1; - v760, v761, v762, v763, v764, v765 = scf.if v406 : i32, i32, i32, i32, i32, u32 { - ^block110: - v745 = arith.constant 0 : u32; - v752 = ub.poison i32 : i32; - scf.yield v372, v383, v752, v752, v752, v745; + 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{ + ^block111: + scf.yield ; } else { ^block58: - v407 = arith.trunc v398 : i32; - v847 = arith.constant 0 : i32; - v408 = arith.constant -2147483648 : i32; - v409 = arith.sub v408, v375 : i32 #[overflow = wrapping]; - v411 = hir.bitcast v409 : u32; - v410 = hir.bitcast v407 : u32; - v412 = arith.lte v410, v411 : i1; - v413 = arith.zext v412 : u32; - v414 = hir.bitcast v413 : i32; - v416 = arith.neq v414, v847 : i1; - v808 = scf.if v416 : i32 { - ^block56: - v846 = arith.constant 0 : i32; - v427 = arith.neq v407, v846 : i1; - v807 = scf.if v427 : i32 { - ^block60: - v845 = arith.constant 0 : i32; - v443 = arith.neq v374, v845 : i1; - v806 = scf.if v443 : i32 { - ^block63: - v425 = 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::alloc::Global::alloc_impl(v383, v375, v407, v425) - v454 = hir.bitcast v383 : u32; - v499 = arith.constant 4 : u32; - v456 = arith.mod v454, v499 : u32; - hir.assertz v456 #[code = 250]; - v457 = hir.int_to_ptr v454 : ptr; - v458 = hir.load v457 : i32; - scf.yield v458; - } else { - ^block64: - v444 = arith.constant 8 : i32; - v445 = arith.add v383, v444 : 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(v445, v375, v407) - v429 = arith.constant 8 : u32; - v446 = hir.bitcast v383 : u32; - v448 = arith.add v446, v429 : u32 #[overflow = checked]; - v844 = arith.constant 4 : u32; - v450 = arith.mod v448, v844 : u32; - hir.assertz v450 #[code = 250]; - v451 = hir.int_to_ptr v448 : ptr; - v452 = hir.load v451 : i32; - scf.yield v452; - }; - v842 = arith.constant 0 : i32; - v843 = arith.constant 0 : i32; - v461 = arith.eq v806, v843 : i1; - v462 = arith.zext v461 : u32; - v463 = hir.bitcast v462 : i32; - v465 = arith.neq v463, v842 : i1; - scf.if v465{ - ^block65: - v841 = arith.constant 8 : u32; - v482 = hir.bitcast v372 : u32; - v484 = arith.add v482, v841 : u32 #[overflow = checked]; - v840 = arith.constant 4 : u32; - v486 = arith.mod v484, v840 : u32; - hir.assertz v486 #[code = 250]; - v487 = hir.int_to_ptr v484 : ptr; - hir.store v487, v407; - v839 = arith.constant 4 : u32; - v489 = hir.bitcast v372 : u32; - v491 = arith.add v489, v839 : u32 #[overflow = checked]; - v838 = arith.constant 4 : u32; - v493 = arith.mod v491, v838 : u32; - hir.assertz v493 #[code = 250]; - v494 = hir.int_to_ptr v491 : ptr; - hir.store v494, v375; - scf.yield ; - } else { - ^block66: - v837 = arith.constant 8 : u32; - v467 = hir.bitcast v372 : u32; - v469 = arith.add v467, v837 : u32 #[overflow = checked]; - v836 = arith.constant 4 : u32; - v471 = arith.mod v469, v836 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - hir.store v472, v806; - v835 = arith.constant 4 : u32; - v474 = hir.bitcast v372 : u32; - v476 = arith.add v474, v835 : u32 #[overflow = checked]; - v834 = arith.constant 4 : u32; - v478 = arith.mod v476, v834 : u32; - hir.assertz v478 #[code = 250]; - v479 = hir.int_to_ptr v476 : ptr; - hir.store v479, v373; - scf.yield ; - }; - v832 = arith.constant 0 : i32; - v833 = arith.constant 1 : i32; - v805 = cf.select v465, v833, v832 : i32; - scf.yield v805; - } else { - ^block61: - v831 = arith.constant 8 : u32; - v428 = hir.bitcast v372 : u32; - v430 = arith.add v428, v831 : u32 #[overflow = checked]; - v830 = arith.constant 4 : u32; - v432 = arith.mod v430, v830 : u32; - hir.assertz v432 #[code = 250]; - v433 = hir.int_to_ptr v430 : ptr; - hir.store v433, v375; - v829 = arith.constant 4 : u32; - v436 = hir.bitcast v372 : u32; - v438 = arith.add v436, v829 : u32 #[overflow = checked]; - v828 = arith.constant 4 : u32; - v440 = arith.mod v438, v828 : u32; - hir.assertz v440 #[code = 250]; - v827 = arith.constant 0 : i32; - v441 = hir.int_to_ptr v438 : ptr; - hir.store v441, v827; - v826 = arith.constant 0 : i32; - scf.yield v826; - }; - scf.yield v807; - } else { - ^block59: - v825 = ub.poison i32 : i32; - scf.yield v825; - }; - v820 = arith.constant 0 : u32; - v753 = arith.constant 1 : u32; - v813 = cf.select v416, v753, v820 : u32; - v821 = ub.poison i32 : i32; - v812 = cf.select v416, v383, v821 : i32; - v822 = ub.poison i32 : i32; - v811 = cf.select v416, v372, v822 : i32; - v823 = ub.poison i32 : i32; - v810 = cf.select v416, v823, v383 : i32; - v824 = ub.poison i32 : i32; - v809 = cf.select v416, v824, v372 : i32; - scf.yield v809, v810, v811, v808, v812, v813; - }; - v766, v767, v768 = scf.index_switch v765 : i32, i32, i32 - case 0 { - ^block57: - v819 = arith.constant 4 : u32; - v419 = hir.bitcast v760 : u32; - v421 = arith.add v419, v819 : u32 #[overflow = checked]; - v818 = arith.constant 4 : u32; - v423 = arith.mod v421, v818 : u32; - hir.assertz v423 #[code = 250]; - v817 = arith.constant 0 : i32; - v424 = hir.int_to_ptr v421 : ptr; - hir.store v424, v817; - v816 = arith.constant 1 : i32; - scf.yield v760, v816, v761; - } - default { - ^block114: - scf.yield v762, v763, v764; + 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) + scf.yield ; }; - v498 = hir.bitcast v766 : u32; - v815 = arith.constant 4 : u32; - v500 = arith.mod v498, v815 : u32; - hir.assertz v500 #[code = 250]; - v501 = hir.int_to_ptr v498 : ptr; - hir.store v501, v767; - v814 = arith.constant 16 : i32; - v506 = arith.add v768, v814 : i32 #[overflow = wrapping]; - v507 = 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 - v508 = hir.bitcast v507 : ptr; - hir.store v508, v506; - builtin.ret ; - }; - - private builtin.function @::allocate(v509: i32, v510: i32, v511: i32) { - ^block67(v509: i32, v510: i32, v511: i32): - v513 = 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 - v514 = hir.bitcast v513 : ptr; - v515 = hir.load v514 : i32; - v516 = arith.constant 16 : i32; - v517 = arith.sub v515, v516 : i32 #[overflow = wrapping]; - v518 = 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 - v519 = hir.bitcast v518 : ptr; - hir.store v519, v517; - v512 = arith.constant 0 : i32; - v520 = arith.constant 8 : i32; - v521 = arith.add v517, v520 : 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::alloc::Global::alloc_impl(v521, v510, v511, v512) - v524 = arith.constant 12 : u32; - v523 = hir.bitcast v517 : 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 : i32; - v531 = arith.constant 8 : u32; - v530 = hir.bitcast v517 : u32; - v532 = arith.add v530, v531 : u32 #[overflow = checked]; - v853 = arith.constant 4 : u32; - v534 = arith.mod v532, v853 : u32; - hir.assertz v534 #[code = 250]; - v535 = hir.int_to_ptr v532 : ptr; - v536 = hir.load v535 : i32; - v537 = hir.bitcast v509 : u32; - v852 = arith.constant 4 : u32; - v539 = arith.mod v537, v852 : u32; - hir.assertz v539 #[code = 250]; - v540 = hir.int_to_ptr v537 : ptr; - hir.store v540, v536; - v851 = arith.constant 4 : u32; - v541 = hir.bitcast v509 : u32; - v543 = arith.add v541, v851 : u32 #[overflow = checked]; - v850 = arith.constant 4 : u32; - v545 = arith.mod v543, v850 : u32; - hir.assertz v545 #[code = 250]; - v546 = hir.int_to_ptr v543 : ptr; - hir.store v546, v529; - v849 = arith.constant 16 : i32; - v548 = arith.add v517, v849 : i32 #[overflow = wrapping]; - v549 = 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 - v550 = hir.bitcast v549 : ptr; - hir.store v550, v548; + 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; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v551: i32, v552: i32, v553: i32, v554: i32) { - ^block69(v551: i32, v552: i32, v553: i32, v554: i32): - v869 = arith.constant 0 : i32; - v555 = arith.constant 0 : i32; - v556 = arith.eq v553, v555 : i1; - v557 = arith.zext v556 : u32; - v558 = hir.bitcast v557 : i32; - v560 = arith.neq v558, v869 : i1; - v865 = scf.if v560 : i32 { - ^block117: - scf.yield v552; + 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; } else { - ^block72: - 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() - v868 = arith.constant 0 : i32; - v562 = arith.neq v554, v868 : i1; - v864 = scf.if v562 : i32 { - ^block73: - v564 = 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(v553, v552) : i32 - scf.yield v564; + ^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; } else { - ^block74: - v563 = 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(v553, v552) : i32 - scf.yield v563; + ^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; }; - scf.yield v864; + v436 = arith.constant 8 : i32; + v766 = arith.constant 4 : i32; + v762 = cf.select v417, v766, v436 : i32; + scf.yield v762, v761; }; - v568 = arith.constant 4 : u32; - v567 = hir.bitcast v551 : u32; - v569 = arith.add v567, v568 : u32 #[overflow = checked]; - v867 = arith.constant 4 : u32; - v571 = arith.mod v569, v867 : u32; - hir.assertz v571 #[code = 250]; - v572 = hir.int_to_ptr v569 : ptr; - hir.store v572, v553; - v574 = hir.bitcast v551 : u32; - v866 = arith.constant 4 : u32; - v576 = arith.mod v574, v866 : u32; - hir.assertz v576 #[code = 250]; - v577 = hir.int_to_ptr v574 : ptr; - hir.store v577, v865; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v578: i32, v579: i32, v580: i32, v581: i32) { - ^block75(v578: i32, v579: i32, v580: i32, v581: i32): - v895 = arith.constant 0 : i32; - v582 = arith.constant 0 : i32; - v586 = arith.eq v581, v582 : i1; - v587 = arith.zext v586 : u32; - v588 = hir.bitcast v587 : i32; - v590 = arith.neq v588, v895 : i1; - v882, v883 = scf.if v590 : i32, i32 { - ^block121: - v894 = arith.constant 0 : i32; - v584 = arith.constant 4 : i32; - scf.yield v584, v894; + 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: + scf.yield ; } else { - ^block78: - v591 = hir.bitcast v579 : u32; - v626 = arith.constant 4 : u32; - v593 = arith.mod v591, v626 : u32; - hir.assertz v593 #[code = 250]; - v594 = hir.int_to_ptr v591 : ptr; - v595 = hir.load v594 : i32; - v892 = arith.constant 0 : i32; - v893 = arith.constant 0 : i32; - v597 = arith.eq v595, v893 : i1; - v598 = arith.zext v597 : u32; - v599 = hir.bitcast v598 : i32; - v601 = arith.neq v599, v892 : i1; - v880 = scf.if v601 : i32 { - ^block120: - v891 = arith.constant 0 : i32; - scf.yield v891; - } else { - ^block79: - v890 = arith.constant 4 : u32; - v602 = hir.bitcast v578 : u32; - v604 = arith.add v602, v890 : u32 #[overflow = checked]; - v889 = arith.constant 4 : u32; - v606 = arith.mod v604, v889 : u32; - hir.assertz v606 #[code = 250]; - v607 = hir.int_to_ptr v604 : ptr; - hir.store v607, v580; - v888 = arith.constant 4 : u32; - v608 = hir.bitcast v579 : u32; - v610 = arith.add v608, v888 : u32 #[overflow = checked]; - v887 = arith.constant 4 : u32; - v612 = arith.mod v610, v887 : u32; - hir.assertz v612 #[code = 250]; - v613 = hir.int_to_ptr v610 : ptr; - v614 = hir.load v613 : i32; - v615 = hir.bitcast v578 : u32; - v886 = arith.constant 4 : u32; - v617 = arith.mod v615, v886 : u32; - hir.assertz v617 #[code = 250]; - v618 = hir.int_to_ptr v615 : ptr; - hir.store v618, v614; - v619 = arith.mul v595, v581 : i32 #[overflow = wrapping]; - scf.yield v619; - }; - v620 = arith.constant 8 : i32; - v885 = arith.constant 4 : i32; - v881 = cf.select v601, v885, v620 : i32; - scf.yield v881, v880; + ^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) + scf.yield ; }; - v623 = arith.add v578, v882 : i32 #[overflow = wrapping]; - v625 = hir.bitcast v623 : u32; - v884 = arith.constant 4 : u32; - v627 = arith.mod v625, v884 : u32; - hir.assertz v627 #[code = 250]; - v628 = hir.int_to_ptr v625 : ptr; - hir.store v628, v883; builtin.ret ; }; - private builtin.function @::deallocate(v629: i32, v630: i32, v631: i32) { - ^block80(v629: i32, v630: i32, v631: i32): - v897 = arith.constant 0 : i32; - v632 = arith.constant 0 : i32; - v633 = arith.eq v631, v632 : i1; - v634 = arith.zext v633 : u32; - v635 = hir.bitcast v634 : i32; - v637 = arith.neq v635, v897 : i1; - scf.if v637{ - ^block82: - scf.yield ; + 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; + 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 { + ^block118: + v784 = arith.constant 0 : u32; + v791 = ub.poison i32 : i32; + scf.yield v496, v507, v791, v791, v791, v784; } else { - ^block83: - 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(v629, v631, v630) - scf.yield ; + ^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; + } 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; + }; + 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; + 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; + scf.yield ; + }; + v871 = arith.constant 1 : i32; + v872 = arith.constant 0 : i32; + v844 = cf.select v585, v872, v871 : i32; + scf.yield v844; + } 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; + }; + scf.yield v846; + } else { + ^block76: + v864 = ub.poison i32 : i32; + scf.yield v864; + }; + 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; + }; + v805, v806, v807 = scf.index_switch v804 : i32, i32, i32 + 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; + } + default { + ^block122: + scf.yield v801, v802, v803; }; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v638: i32, v639: i32, v640: i32) { - ^block84(v638: i32, v639: i32, v640: i32): + private builtin.function @alloc::raw_vec::handle_error(v629: i32, v630: i32) { + ^block84(v629: i32, v630: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v641: i32, v642: i32) -> i32 { - ^block86(v641: i32, v642: i32): - v649 = arith.constant 0 : i32; - v645 = hir.bitcast v642 : u32; - v644 = hir.bitcast v641 : u32; - v646 = arith.gt v644, v645 : i1; - v647 = arith.zext v646 : u32; - v648 = hir.bitcast v647 : i32; - v650 = arith.neq v648, v649 : i1; - v651 = cf.select v650, v641, v642 : i32; - builtin.ret v651; + 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 @miden::output_note::get_assets(v652: i32, v653: felt) -> i32 { - ^block88(v652: i32, v653: felt): - v654, v655 = hir.exec @miden/output_note/get_assets(v652, v653) : i32, i32 - builtin.ret v654; + 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; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -945,14 +936,12 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x003e64657463616465723c; - - builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; + builtin.segment @1048576 = 0x0000000100000001; }; public builtin.function @binding() -> felt { ^block92: - v657 = 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 v657; + 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; }; }; \ 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 19e5df20b..a1120044e 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 @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] adv.push_mapval push.262144 - push.3 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + 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 @@ -45,7 +45,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -53,7 +53,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048612 + push.1048584 u32wrapping_add movup.2 swap.1 @@ -73,7 +73,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -81,7 +81,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048612 + push.1048584 u32wrapping_add dup.1 swap.2 @@ -167,7 +167,7 @@ end proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding( ) -> felt - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -177,7 +177,7 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -237,13 +237,13 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse 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::RawVecInner::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 push.16 movup.2 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -264,7 +264,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -272,7 +272,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048616 + push.1048588 u32wrapping_add u32divmod.4 swap.1 @@ -293,7 +293,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -307,7 +307,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048616 + push.1048588 movup.2 u32wrapping_add u32divmod.4 @@ -365,7 +365,7 @@ proc ::alloc( movup.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::core::ptr::alignment::Alignment::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 push.0 @@ -526,8 +526,10 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc alloc::vec::Vec::with_capacity(i32) - push.1114176 +proc >::with_capacity( + i32 +) + push.1114144 u32divmod.4 swap.1 trace.240 @@ -537,7 +539,7 @@ proc alloc::vec::Vec::with_capacity(i32) nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -556,7 +558,7 @@ proc alloc::vec::Vec::with_capacity(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::raw_vec::RawVecInner::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 push.8 @@ -614,7 +616,7 @@ proc alloc::vec::Vec::with_capacity(i32) nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -625,12 +627,12 @@ proc alloc::vec::Vec::with_capacity(i32) end @callconv("C") -proc alloc::raw_vec::RawVecInner::with_capacity_in( +proc ::with_capacity_in( i32, i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -640,7 +642,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -663,7 +665,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( movdn.3 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::RawVecInner::try_allocate_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::::try_allocate_in trace.252 nop push.8 @@ -756,7 +758,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -767,16 +769,8 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( else movup.2 drop - push.1114180 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.12 - movup.3 + movup.2 add u32assert push.4 @@ -792,10 +786,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048596 - movup.2 - u32wrapping_add - 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::alloc::raw_vec::handle_error @@ -811,7 +802,7 @@ proc miden_base_sys::bindings::output_note::get_assets( i32, felt ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -821,7 +812,7 @@ proc miden_base_sys::bindings::output_note::get_assets( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -836,7 +827,7 @@ proc miden_base_sys::bindings::output_note::get_assets( 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::alloc::vec::Vec::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 push.8 @@ -919,7 +910,7 @@ proc miden_base_sys::bindings::output_note::get_assets( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -935,12 +926,90 @@ proc intrinsics::felt::from_u32(i32) -> felt end @callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +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.::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 + push.0 + movup.4 + neq + if.true + 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 + trace.252 + nop + else + 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 + 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.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -950,7 +1019,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -970,7 +1039,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( 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::RawVecInner::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 push.8 @@ -1041,7 +1110,139 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114176 + 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 @@ -1052,14 +1253,38 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( +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.::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 + +@callconv("C") +proc ::allocate( i32, i32, i32 ) - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1069,7 +1294,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1079,14 +1304,135 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 push.0 - push.0 - dup.7 - u32wrapping_sub - push.4294967295 - movup.9 - dup.9 + push.8 + dup.2 + 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 + 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 @@ -1163,7 +1509,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( 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::alloc::Global::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 dup.2 @@ -1211,14 +1557,12 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop end push.0 - push.0 - dup.2 - eq + dup.1 neq dup.0 if.true - movup.6 - movup.2 + movup.7 + movup.4 drop drop push.8 @@ -1231,7 +1575,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.3 + movup.2 swap.1 u32divmod.4 swap.1 @@ -1260,8 +1604,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop else - movup.7 - movup.4 + movup.6 + movup.2 drop drop push.8 @@ -1274,7 +1618,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( u32mod u32assert assertz - movup.2 + movup.3 swap.1 u32divmod.4 swap.1 @@ -1303,8 +1647,8 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( trace.252 nop end - push.0 push.1 + push.0 movup.2 cdrop else @@ -1454,7 +1798,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1465,363 +1809,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( end @callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114176 - 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.::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::alloc::Global::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.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::Global::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.::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 - push.0 - movup.4 - neq - if.true - 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 - trace.252 - nop - else - 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 - 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 alloc::raw_vec::RawVecInner::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.::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 - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop +proc alloc::raw_vec::handle_error(i32, i32) drop drop push.0 @@ -1829,7 +1817,10 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) end @callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 +proc ::max( + i32, + i32 +) -> i32 push.0 dup.2 dup.2 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 e6cbffb40..1b50173b4 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 (param i32 i32) (result i32))) (type (;2;) (func (param i32 i32 i32))) @@ -16,9 +16,10 @@ (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 i32))) - (type (;10;) (func (param i32 i32 i32 i32))) - (type (;11;) (func (param i32 f32) (result i32))) + (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 f32) (result i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -29,7 +30,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048612 + i32.const 1048584 i32.add local.get 1 local.get 0 @@ -39,7 +40,7 @@ (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 1048612 + i32.const 1048584 i32.add local.get 1 local.get 0 @@ -81,7 +82,7 @@ i32.add i32.const 16 i32.const 16 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 0 i32.const 16 i32.add @@ -95,7 +96,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048616 + i32.const 1048588 i32.add i32.load8_u br_if 0 (;@1;) @@ -103,7 +104,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048616 + i32.const 1048588 i32.add i32.const 1 i32.store8 @@ -128,7 +129,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -184,7 +185,7 @@ (func $intrinsics::mem::heap_base (;9;) (type 5) (result i32) unreachable ) - (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32) + (func $>::with_capacity (;10;) (type 6) (param i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -196,7 +197,7 @@ i32.add i32.const 16 i32.const 16 - call $alloc::raw_vec::RawVecInner::with_capacity_in + call $::with_capacity_in local.get 1 i64.load offset=8 local.set 2 @@ -211,7 +212,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 2) (param i32 i32 i32) + (func $::with_capacity_in (;11;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -225,7 +226,7 @@ i32.const 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::try_allocate_in + call $::try_allocate_in local.get 3 i32.load offset=8 local.set 2 @@ -235,14 +236,9 @@ i32.const 1 i32.ne br_if 0 (;@1;) - global.get $GOT.data.internal.__memory_base - local.set 0 local.get 2 local.get 3 i32.load offset=12 - local.get 0 - i32.const 1048596 - i32.add call $alloc::raw_vec::handle_error unreachable end @@ -268,7 +264,7 @@ local.get 2 i32.const 4 i32.add - call $alloc::vec::Vec::with_capacity + call $>::with_capacity local.get 0 i32.const 8 i32.add @@ -291,7 +287,34 @@ (func $intrinsics::felt::from_u32 (;13;) (type 8) (param i32) (result f32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;14;) (type 2) (param i32 i32 i32) + (func $::alloc_impl (;14;) (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 (;15;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -304,7 +327,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -323,7 +346,82 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 9) (param i32 i32 i32 i32 i32) + (func $::current_memory (;16;) (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 (;17;) (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 (;18;) (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 (;19;) (type 10) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -399,32 +497,31 @@ local.get 3 local.get 4 i32.const 1 - call $alloc::alloc::Global::alloc_impl + call $::alloc_impl local.get 5 i32.load local.set 2 end block ;; label = @2 local.get 2 - i32.eqz br_if 0 (;@2;) local.get 0 - local.get 2 + local.get 4 i32.store offset=8 local.get 0 - local.get 1 + local.get 3 i32.store offset=4 - i32.const 0 + i32.const 1 local.set 3 br 1 (;@1;) end local.get 0 - local.get 4 + local.get 2 i32.store offset=8 local.get 0 - local.get 3 + local.get 1 i32.store offset=4 - i32.const 1 + i32.const 0 local.set 3 end local.get 0 @@ -435,112 +532,10 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;16;) (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::alloc::Global::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 $alloc::alloc::Global::alloc_impl (;17;) (type 10) (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 $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 10) (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 (;19;) (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 $alloc::raw_vec::handle_error (;20;) (type 2) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;20;) (type 11) (param i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;21;) (type 1) (param i32 i32) (result i32) + (func $::max (;21;) (type 1) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -548,21 +543,20 @@ i32.gt_u select ) - (func $miden::output_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) + (func $miden::output_note::get_assets (;22;) (type 12) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "\00") - (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") + (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-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-get-assets-binding/rust-sdk-output-note-get-assets-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))) @@ -572,11 +566,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-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 (;2;) "miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1" (instance $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1-shim-instance)) ) 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 b8dc84853..bf0315c8d 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 @@ -125,7 +125,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v46, v88) + 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]; @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v99: i32, v100: i32) { + 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; 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 d5ff6e4b1..75ef05506 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 @@ -321,7 +321,7 @@ proc miden_base_sys::bindings::output_note::get_assets_info( 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 @@ -354,7 +354,7 @@ proc miden_base_sys::bindings::output_note::get_assets_info( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 30967d2ec..ffe88ea9d 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 @@ -1,12 +1,12 @@ (component - (type (;0;) + (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 (;0;) (type 0))) - (core module (;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 i32 f32))) @@ -86,7 +86,7 @@ local.get 2 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 0 local.get 1 f32.store offset=16 @@ -95,7 +95,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -162,14 +162,14 @@ (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") ) - (alias export 0 "felt" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (component (;0;) + (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-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-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-get-assets-info-binding/rust-sdk-output-note-get-assets-info-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))) @@ -179,11 +179,11 @@ (type (;5;) (func (result 4))) (export (;1;) "binding" (func 0) (func (type 5))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-felt0" (type 1)) + (instance $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-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 (;2;) "miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1" (instance $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1-shim-instance)) ) 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 07cd5b8ac..d19593080 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 @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + 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 @@ -151,7 +151,7 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + 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; 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 da7acb964..93f1c238b 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 @@ -417,7 +417,7 @@ proc miden_base_sys::bindings::output_note::get_metadata( 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 @@ -433,7 +433,7 @@ proc miden_base_sys::bindings::output_note::get_metadata( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 f030f66a3..50fd74900 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,8 +8,8 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -94,13 +94,13 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -167,15 +167,15 @@ (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") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $word))) + (alias core export $main "miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -188,12 +188,12 @@ (type (;8;) (func (result 7))) (export (;1;) "binding" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1" (instance $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1-shim-instance)) ) 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 3c81ccd98..ce2428a71 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 @@ -142,7 +142,7 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + 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 @@ -151,7 +151,7 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + 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; 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 85cc62544..144af393b 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 @@ -420,7 +420,7 @@ proc miden_base_sys::bindings::output_note::get_recipient( 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::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 @@ -436,7 +436,7 @@ proc miden_base_sys::bindings::output_note::get_recipient( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) 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 e6daa1396..8ce966423 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -10,8 +10,8 @@ (export (;6;) "recipient" (type (eq 5))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 i32))) (type (;2;) (func (param i32 f32))) @@ -96,13 +96,13 @@ local.get 2 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 2 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $::reverse (;5;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -169,16 +169,16 @@ (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") ) - (alias export 0 "recipient" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (result 1))) - (alias core export 0 "miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (alias export 0 "recipient" (type (;5;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "recipient" (type $recipient (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $recipient))) + (alias core export $main "miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding) (memory $memory))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) + (alias export $miden:base/core-types@1.0.0 "recipient" (type $"#type5 recipient" (@name "recipient") (;5;))) + (component $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -193,13 +193,13 @@ (type (;10;) (func (result 9))) (export (;1;) "binding" (func 0) (func (type 10))) ) - (instance (;1;) (instantiate 0 - (with "import-func-binding" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-recipient" (type 5)) - (with "import-type-recipient0" (type 1)) + (instance $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $word)) + (with "import-type-recipient" (type $"#type5 recipient")) + (with "import-type-recipient0" (type $recipient)) ) ) - (export (;2;) "miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1" (instance 1)) + (export $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1" (instance $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-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 90c4ac11d..f2a8679ec 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 @@ -5,8 +5,13 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; + private builtin.function @rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + private builtin.function @::eq(v0: i32, v1: i32) -> i32 { - ^block7(v0: i32, v1: i32): + ^block9(v0: i32, v1: i32): v5 = hir.bitcast v0 : u32; v6 = arith.constant 4 : u32; v7 = arith.mod v5, v6 : u32; @@ -27,11 +32,11 @@ builtin.component miden:base/note-script@1.0.0 { v19 = hir.bitcast v18 : i32; v21 = arith.neq v19, v3 : i1; v441 = scf.if v21 : i32 { - ^block9: + ^block11: v462 = arith.constant 0 : i32; scf.yield v462; } else { - ^block10: + ^block12: v461 = arith.constant 4 : u32; v22 = hir.bitcast v0 : u32; v24 = arith.add v22, v461 : u32 #[overflow = checked]; @@ -60,7 +65,7 @@ builtin.component miden:base/note-script@1.0.0 { v455 = arith.constant 0 : i32; scf.yield v455; } else { - ^block11: + ^block13: v44 = arith.constant 8 : u32; v43 = hir.bitcast v0 : u32; v45 = arith.add v43, v44 : u32 #[overflow = checked]; @@ -89,7 +94,7 @@ builtin.component miden:base/note-script@1.0.0 { v449 = arith.constant 0 : i32; scf.yield v449; } else { - ^block12: + ^block14: v65 = arith.constant 12 : u32; v64 = hir.bitcast v0 : u32; v66 = arith.add v64, v65 : u32 #[overflow = checked]; @@ -120,11 +125,6 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v441; }; - private builtin.function @rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports() { - ^block13: - builtin.ret ; - }; - 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 @@ -295,152 +295,152 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_account::get_balance(v188: felt, v189: felt) -> felt { - ^block27(v188: felt, v189: felt): - v191 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_account::get_balance(v188, v189) : felt - builtin.ret v191; - }; - - private builtin.function @miden_base_sys::bindings::active_note::get_sender(v192: i32) { - ^block29(v192: i32): - v194 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v195 = hir.bitcast v194 : ptr; - v196 = hir.load v195 : i32; - v197 = arith.constant 16 : i32; - v198 = arith.sub v196, v197 : i32 #[overflow = wrapping]; - v199 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v200 = hir.bitcast v199 : ptr; - hir.store v200, v198; - v201 = arith.constant 8 : i32; - v202 = arith.add v198, v201 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_sender(v202) - v204 = arith.constant 8 : u32; - v203 = hir.bitcast v198 : u32; - v205 = arith.add v203, v204 : 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; - v209 = hir.load v208 : i64; - v210 = hir.bitcast v192 : u32; + 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; - v212 = arith.mod v210, v503 : u32; - hir.assertz v212 #[code = 250]; - v213 = hir.int_to_ptr v210 : ptr; - hir.store v213, v209; + v208 = arith.mod v206, v503 : u32; + hir.assertz v208 #[code = 250]; + v209 = hir.int_to_ptr v206 : ptr; + hir.store v209, v205; v502 = arith.constant 16 : i32; - v215 = arith.add v198, v502 : i32 #[overflow = wrapping]; - v216 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v217 = hir.bitcast v216 : ptr; - hir.store v217, v215; + 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(v218: i32) { - ^block31(v218: i32): - v220 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v221 = hir.bitcast v220 : ptr; - v222 = hir.load v221 : i32; - v223 = arith.constant 32 : i32; - v224 = arith.sub v222, v223 : i32 #[overflow = wrapping]; - v225 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v226 = hir.bitcast v225 : ptr; - hir.store v226, v224; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_script_root(v224) - v228 = arith.constant 8 : u32; - v227 = hir.bitcast v224 : u32; - v229 = arith.add v227, v228 : u32 #[overflow = checked]; + 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; - v231 = arith.mod v229, v508 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : i64; - v235 = arith.constant 24 : u32; - v234 = hir.bitcast v224 : u32; - v236 = arith.add v234, v235 : u32 #[overflow = checked]; + 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; - v238 = arith.mod v236, v507 : 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; + v506 = arith.constant 8 : u32; + v238 = arith.mod v236, v506 : u32; hir.assertz v238 #[code = 250]; v239 = hir.int_to_ptr v236 : ptr; - hir.store v239, v233; - v240 = hir.bitcast v224 : u32; - v506 = arith.constant 8 : u32; - v242 = arith.mod v240, v506 : u32; - hir.assertz v242 #[code = 250]; - v243 = hir.int_to_ptr v240 : ptr; - v244 = hir.load v243 : i64; - v246 = arith.constant 16 : u32; - v245 = hir.bitcast v224 : u32; - v247 = arith.add v245, v246 : u32 #[overflow = checked]; + 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; - v249 = arith.mod v247, v505 : u32; - hir.assertz v249 #[code = 250]; - v250 = hir.int_to_ptr v247 : ptr; - hir.store v250, v244; - v251 = arith.constant 16 : i32; - v252 = arith.add v224, v251 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_stdlib_sys::intrinsics::word::Word::reverse(v218, v252) + 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; - v254 = arith.add v224, v504 : i32 #[overflow = wrapping]; - v255 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v256 = hir.bitcast v255 : ptr; - hir.store v256, v254; + 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; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_serial_number(v257: i32) { - ^block33(v257: i32): - v259 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v260 = hir.bitcast v259 : ptr; - v261 = hir.load v260 : i32; - v262 = arith.constant 32 : i32; - v263 = arith.sub v261, v262 : i32 #[overflow = wrapping]; - v264 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v265 = hir.bitcast v264 : ptr; - hir.store v265, v263; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_serial_number(v263) - v267 = arith.constant 8 : u32; - v266 = hir.bitcast v263 : u32; - v268 = arith.add v266, v267 : u32 #[overflow = checked]; + 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]; v513 = arith.constant 8 : u32; - v270 = arith.mod v268, v513 : u32; - hir.assertz v270 #[code = 250]; - v271 = hir.int_to_ptr v268 : ptr; - v272 = hir.load v271 : i64; - v274 = arith.constant 24 : u32; - v273 = hir.bitcast v263 : u32; - v275 = arith.add v273, v274 : u32 #[overflow = checked]; + 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; - v277 = arith.mod v275, v512 : 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; - hir.store v278, v272; - v279 = hir.bitcast v263 : u32; - v511 = arith.constant 8 : u32; - v281 = arith.mod v279, v511 : u32; - hir.assertz v281 #[code = 250]; - v282 = hir.int_to_ptr v279 : ptr; - v283 = hir.load v282 : i64; - v285 = arith.constant 16 : u32; - v284 = hir.bitcast v263 : u32; - v286 = arith.add v284, v285 : u32 #[overflow = checked]; + 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; - v288 = arith.mod v286, v510 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - hir.store v289, v283; - v290 = arith.constant 16 : i32; - v291 = arith.add v263, v290 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_stdlib_sys::intrinsics::word::Word::reverse(v257, v291) + 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; - v293 = arith.add v263, v509 : i32 #[overflow = wrapping]; - v294 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v295 = hir.bitcast v294 : ptr; - hir.store v295, v293; + 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; builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v296: i32, v297: i32) { + 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; @@ -580,37 +580,37 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v392; }; - private builtin.function @miden::active_note::get_sender(v394: i32) { + private builtin.function @miden::active_note::get_script_root(v394: i32) { ^block47(v394: i32): - v395, v396 = hir.exec @miden/active_note/get_sender() : felt, felt - v397 = hir.bitcast v394 : u32; - v398 = hir.int_to_ptr v397 : ptr; - hir.store v398, v395; - v399 = arith.constant 4 : u32; - v400 = arith.add v397, v399 : u32 #[overflow = checked]; - v401 = hir.int_to_ptr v400 : ptr; - hir.store v401, v396; + 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; builtin.ret ; }; - private builtin.function @miden::active_note::get_script_root(v402: i32) { - ^block50(v402: i32): - v403, v404, v405, v406 = hir.exec @miden/active_note/get_script_root() : felt, felt, felt, felt - v407 = hir.bitcast v402 : u32; - v408 = hir.int_to_ptr v407 : ptr; - hir.store v408, v403; - v409 = arith.constant 4 : u32; - v410 = arith.add v407, v409 : u32 #[overflow = checked]; - v411 = hir.int_to_ptr v410 : ptr; - hir.store v411, v404; - v412 = arith.constant 8 : u32; - v413 = arith.add v407, v412 : u32 #[overflow = checked]; + 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, v405; - v415 = arith.constant 12 : u32; - v416 = arith.add v407, v415 : u32 #[overflow = checked]; + 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, v406; + hir.store v417, v412; builtin.ret ; }; 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 19c56a9ca..3c2a03122 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 @@ -41,6 +41,13 @@ proc __wasm_call_ctors( nop end +@callconv("C") +proc rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports( + +) + nop +end + @callconv("C") proc ::eq( i32, @@ -237,13 +244,6 @@ proc ::eq( end end -@callconv("C") -proc rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports( - -) - nop -end - @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -537,18 +537,6 @@ proc wit_bindgen::rt::run_ctors_once( end 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 - trace.252 - nop -end - @callconv("C") proc miden_base_sys::bindings::active_note::get_sender( i32 @@ -734,7 +722,7 @@ proc miden_base_sys::bindings::active_note::get_script_root( movup.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::::reverse trace.252 nop push.32 @@ -856,7 +844,7 @@ proc miden_base_sys::bindings::active_note::get_serial_number( movup.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::::reverse trace.252 nop push.32 @@ -872,7 +860,19 @@ proc miden_base_sys::bindings::active_note::get_serial_number( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +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 + trace.252 + nop +end + +@callconv("C") +proc ::reverse( i32, i32 ) @@ -1163,13 +1163,13 @@ proc miden::active_account::get_balance(felt, felt) -> felt end @callconv("C") -proc miden::active_note::get_sender(i32) +proc miden::active_note::get_script_root(i32) trace.240 nop - exec.::miden::active_note::get_sender + exec.::miden::active_note::get_script_root trace.252 nop - movup.2 + movup.4 dup.0 movup.2 swap.1 @@ -1181,8 +1181,11 @@ proc miden::active_note::get_sender(i32) trace.252 nop push.4 + dup.1 add u32assert + movup.2 + swap.1 u32divmod.4 swap.1 trace.240 @@ -1190,17 +1193,10 @@ proc miden::active_note::get_sender(i32) exec.::intrinsics::mem::store_felt trace.252 nop -end - -@callconv("C") -proc miden::active_note::get_script_root(i32) - trace.240 - nop - exec.::miden::active_note::get_script_root - trace.252 - nop - movup.4 - dup.0 + push.8 + dup.1 + add + u32assert movup.2 swap.1 u32divmod.4 @@ -1210,12 +1206,9 @@ proc miden::active_note::get_script_root(i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.4 - dup.1 + push.12 add u32assert - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1223,10 +1216,17 @@ proc miden::active_note::get_script_root(i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.8 - dup.1 - add - u32assert +end + +@callconv("C") +proc miden::active_note::get_sender(i32) + trace.240 + nop + exec.::miden::active_note::get_sender + trace.252 + nop + movup.2 + dup.0 movup.2 swap.1 u32divmod.4 @@ -1236,7 +1236,7 @@ proc miden::active_note::get_script_root(i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.12 + push.4 add u32assert u32divmod.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 90012617a..cd8a75d70 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 @@ -1,5 +1,5 @@ (component - (type (;0;) + (type $ty-miden:base/core-types@1.0.0 (;0;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -8,13 +8,13 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) - (core module (;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 (param i32 i32) (result i32))) (type (;2;) (func (param f32 f32 f32 f32))) - (type (;3;) (func (param f32 f32) (result f32))) - (type (;4;) (func (param i32))) + (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))) (table (;0;) 2 2 funcref) @@ -25,7 +25,8 @@ (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_swapp_note_bindings::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) - (func $::eq (;1;) (type 1) (param i32 i32) (result i32) + (func $rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $::eq (;2;) (type 1) (param i32 i32) (result i32) (local i32) i32.const 0 local.set 2 @@ -65,7 +66,6 @@ end local.get 2 ) - (func $rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports (;2;) (type 0)) (func $miden:base/note-script@1.0.0#run (;3;) (type 2) (param f32 f32 f32 f32) (local i32 f32 f32 f32) global.get $__stack_pointer @@ -159,12 +159,7 @@ i32.store8 end ) - (func $miden_base_sys::bindings::active_account::get_balance (;5;) (type 3) (param f32 f32) (result f32) - local.get 0 - local.get 1 - call $miden::active_account::get_balance - ) - (func $miden_base_sys::bindings::active_note::get_sender (;6;) (type 4) (param i32) + (func $miden_base_sys::bindings::active_note::get_sender (;5;) (type 3) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -184,7 +179,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_script_root (;7;) (type 4) (param i32) + (func $miden_base_sys::bindings::active_note::get_script_root (;6;) (type 3) (param i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -205,13 +200,13 @@ local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_serial_number (;8;) (type 4) (param i32) + (func $miden_base_sys::bindings::active_note::get_serial_number (;7;) (type 3) (param i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -232,13 +227,18 @@ local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 1 i32.const 32 i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;9;) (type 5) (param i32 i32) + (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 @@ -299,29 +299,29 @@ (func $intrinsics::felt::eq (;10;) (type 6) (param f32 f32) (result i32) unreachable ) - (func $miden::active_account::get_balance (;11;) (type 3) (param f32 f32) (result f32) + (func $miden::active_account::get_balance (;11;) (type 4) (param f32 f32) (result f32) unreachable ) - (func $miden::active_note::get_sender (;12;) (type 4) (param i32) + (func $miden::active_note::get_script_root (;12;) (type 3) (param i32) unreachable ) - (func $miden::active_note::get_script_root (;13;) (type 4) (param i32) + (func $miden::active_note::get_sender (;13;) (type 3) (param i32) unreachable ) - (func $miden::active_note::get_serial_number (;14;) (type 4) (param i32) + (func $miden::active_note::get_serial_number (;14;) (type 3) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;1;))) - (core instance (;0;) (instantiate 0)) - (alias core export 0 "memory" (core memory (;0;))) - (type (;2;) (func (param "arg" 1))) - (alias core export 0 "miden:base/note-script@1.0.0#run" (core func (;0;))) - (func (;0;) (type 2) (canon lift (core func 0))) - (alias export 0 "felt" (type (;3;))) - (alias export 0 "word" (type (;4;))) - (component (;0;) + (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (param "arg" $word))) + (alias core export $main "miden:base/note-script@1.0.0#run" (core func $miden:base/note-script@1.0.0#run (;0;))) + (func $run (;0;) (type 2) (canon lift (core func $miden:base/note-script@1.0.0#run))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;3;))) + (alias export $miden:base/core-types@1.0.0 "word" (type $"#type4 word" (@name "word") (;4;))) + (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) (type (;2;) (tuple 1 1 1 1)) @@ -334,12 +334,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;1;) (instantiate 0 - (with "import-func-run" (func 0)) - (with "import-type-felt" (type 3)) - (with "import-type-word" (type 4)) - (with "import-type-word0" (type 1)) + (instance $miden:base/note-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/note-script@1.0.0-shim-component + (with "import-func-run" (func $run)) + (with "import-type-felt" (type $felt)) + (with "import-type-word" (type $"#type4 word")) + (with "import-type-word0" (type $word)) ) ) - (export (;2;) "miden:base/note-script@1.0.0" (instance 1)) + (export $miden:base/note-script@1.0.0 (;2;) "miden:base/note-script@1.0.0" (instance $miden:base/note-script@1.0.0-shim-instance)) ) diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir index fb696203a..989a17c15 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir @@ -1,426 +1,628 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @rust_sdk_stdlib_sha256_hash { - private builtin.function @core::slice::::reverse(v0: i32) { - ^block4(v0: i32): - v2 = arith.constant 3 : i32; - v3 = arith.add v0, v2 : i32 #[overflow = wrapping]; - v1 = arith.constant 0 : i32; - v333, v334, v335 = scf.while v1, v0, v3 : i32, i32, i32 { - ^block7(v5: i32, v12: i32, v19: i32): - v354 = arith.constant 0 : i32; - v6 = arith.constant 2 : i32; - v7 = arith.eq v5, v6 : i1; - v8 = arith.zext v7 : u32; - v9 = hir.bitcast v8 : i32; - v11 = arith.neq v9, v354 : i1; - v348, v349 = scf.if v11 : i32, i32 { - ^block33: - v326 = ub.poison i32 : i32; - scf.yield v326, v326; + 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; + 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; } else { ^block9: - v13 = arith.add v12, v5 : i32 #[overflow = wrapping]; - v14 = hir.bitcast v13 : u32; - v15 = hir.int_to_ptr v14 : ptr; - v16 = hir.load v15 : u8; - v20 = hir.bitcast v19 : u32; - v21 = hir.int_to_ptr v20 : ptr; - v22 = hir.load v21 : u8; - v23 = arith.zext v22 : u32; - v24 = hir.bitcast v23 : i32; + v19 = hir.bitcast v18 : u32; + v20 = hir.int_to_ptr v19 : ptr; + v21 = hir.load v20 : u8; v25 = hir.bitcast v24 : u32; - v26 = arith.trunc v25 : u8; - v27 = hir.bitcast v13 : u32; - v28 = hir.int_to_ptr v27 : ptr; - hir.store v28, v26; - v17 = arith.zext v16 : u32; - v18 = hir.bitcast v17 : i32; - v29 = hir.bitcast v18 : u32; - v30 = arith.trunc v29 : u8; - v31 = hir.bitcast v19 : u32; - v32 = hir.int_to_ptr v31 : ptr; - hir.store v32, v30; - v33 = arith.constant -1 : i32; - v34 = arith.add v19, v33 : i32 #[overflow = wrapping]; - v35 = arith.constant 1 : i32; - v36 = arith.add v5, v35 : i32 #[overflow = wrapping]; - scf.yield v36, v34; + 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; }; - v353 = ub.poison i32 : i32; - v350 = cf.select v11, v353, v12 : i32; - v325 = arith.constant 1 : u32; - v319 = arith.constant 0 : u32; - v352 = cf.select v11, v319, v325 : u32; - v342 = arith.trunc v352 : i1; - scf.condition v342, v348, v350, v349; + 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; } do { - ^block32(v339: i32, v340: i32, v341: i32): - scf.yield v339, v340, v341; + ^block37(v498: i32, v499: i32, v500: i32): + scf.yield v498, v499, v500; }; builtin.ret ; }; - public builtin.function @entrypoint(v37: i32, v38: i32) { - ^block10(v37: i32, v38: i32): - v40 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - v42 = hir.load v41 : i32; - v45 = arith.constant -32 : i32; - v43 = arith.constant 64 : i32; - v44 = arith.sub v42, v43 : i32 #[overflow = wrapping]; - v46 = arith.band v44, v45 : i32; - v47 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr - v48 = hir.bitcast v47 : ptr; - hir.store v48, v46; - v51 = arith.constant 24 : i32; - v54 = arith.add v38, v51 : i32 #[overflow = wrapping]; - v55 = hir.bitcast v54 : u32; - v56 = hir.int_to_ptr v55 : ptr; - v57 = hir.load v56 : i64; - v564 = arith.constant 24 : i32; - v49 = arith.constant 32 : i32; - v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; - v52 = arith.add v50, v564 : i32 #[overflow = wrapping]; - v58 = hir.bitcast v52 : u32; - v59 = arith.constant 8 : u32; - v60 = arith.mod v58, v59 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - hir.store v61, v57; - v64 = arith.constant 16 : i32; - v67 = arith.add v38, v64 : i32 #[overflow = wrapping]; - v68 = hir.bitcast v67 : u32; - v69 = hir.int_to_ptr v68 : ptr; - v70 = hir.load v69 : i64; - v562 = arith.constant 16 : i32; - v563 = arith.constant 32 : i32; - v63 = arith.add v46, v563 : i32 #[overflow = wrapping]; - v65 = arith.add v63, v562 : i32 #[overflow = wrapping]; - v71 = hir.bitcast v65 : u32; - v561 = arith.constant 8 : u32; - v73 = arith.mod v71, v561 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - hir.store v74, v70; - v77 = arith.constant 8 : i32; - v80 = arith.add v38, v77 : i32 #[overflow = wrapping]; - v81 = hir.bitcast v80 : u32; - v82 = hir.int_to_ptr v81 : ptr; - v83 = hir.load v82 : i64; - v559 = arith.constant 8 : i32; - v560 = arith.constant 32 : i32; - v76 = arith.add v46, v560 : i32 #[overflow = wrapping]; - v78 = arith.add v76, v559 : i32 #[overflow = wrapping]; - v84 = hir.bitcast v78 : u32; - v558 = arith.constant 8 : u32; - v86 = arith.mod v84, v558 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - hir.store v87, v83; - v88 = hir.bitcast v38 : u32; - v89 = hir.int_to_ptr v88 : ptr; - v90 = hir.load v89 : i64; - v92 = arith.constant 32 : u32; - v91 = hir.bitcast v46 : u32; - v93 = arith.add v91, v92 : u32 #[overflow = checked]; - v557 = arith.constant 8 : u32; - v95 = arith.mod v93, v557 : u32; - hir.assertz v95 #[code = 250]; - v96 = hir.int_to_ptr v93 : ptr; - hir.store v96, v90; - v39 = arith.constant 0 : i32; - v490, v491, v492, v493, v494, v495, v496 = scf.while v39, v46, v37, v42 : i32, i32, i32, i32, i32, i32, i32 { - ^block49(v497: i32, v498: i32, v499: i32, v500: i32): - v555 = arith.constant 0 : i32; - v556 = arith.constant 32 : i32; - v100 = arith.eq v497, v556 : i1; - v101 = arith.zext v100 : u32; - v102 = hir.bitcast v101 : i32; - v104 = arith.neq v102, v555 : i1; - v484 = scf.if v104 : i32 { - ^block45: - v363 = ub.poison i32 : i32; - scf.yield v363; + 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; + 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; + } 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: + scf.yield ; } else { - ^block15: - v554 = arith.constant 32 : i32; - v107 = arith.add v498, v554 : i32 #[overflow = wrapping]; - v108 = arith.add v107, v497 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/core::slice::::reverse(v108) - v109 = arith.constant 4 : i32; - v110 = arith.add v497, v109 : i32 #[overflow = wrapping]; - scf.yield v110; + ^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; + scf.yield ; }; - v551 = ub.poison i32 : i32; - v487 = cf.select v104, v551, v500 : i32; - v552 = ub.poison i32 : i32; - v486 = cf.select v104, v552, v499 : i32; - v553 = ub.poison i32 : i32; - v485 = cf.select v104, v553, v498 : i32; - v362 = arith.constant 1 : u32; - v355 = arith.constant 0 : u32; - v489 = cf.select v104, v355, v362 : u32; - v447 = arith.trunc v489 : i1; - scf.condition v447, v484, v485, v486, v487, v498, v499, v500; - } do { - ^block50(v501: i32, v502: i32, v503: i32, v504: i32, v505: i32, v506: i32, v507: i32): - scf.yield v501, v502, v503, v504; + v531 = arith.constant 0 : i32; + v526 = cf.select v81, v531, v61 : i32; + scf.yield v526; }; - v550 = arith.constant 32 : u32; - v111 = hir.bitcast v494 : u32; - v113 = arith.add v111, v550 : 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; - v117 = hir.load v116 : i32; - v119 = arith.constant 36 : u32; - v118 = hir.bitcast v494 : u32; - v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v549 = arith.constant 4 : u32; - v122 = arith.mod v120, v549 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - v124 = hir.load v123 : i32; - v126 = arith.constant 40 : u32; - v125 = hir.bitcast v494 : u32; - v127 = arith.add v125, v126 : u32 #[overflow = checked]; - v548 = arith.constant 4 : u32; - v129 = arith.mod v127, v548 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i32; - v133 = arith.constant 44 : u32; - v132 = hir.bitcast v494 : u32; - v134 = arith.add v132, v133 : u32 #[overflow = checked]; - v547 = arith.constant 4 : u32; - v136 = arith.mod v134, v547 : u32; - hir.assertz v136 #[code = 250]; - v137 = hir.int_to_ptr v134 : ptr; - v138 = hir.load v137 : i32; - v140 = arith.constant 48 : u32; - v139 = hir.bitcast v494 : u32; - v141 = arith.add v139, v140 : u32 #[overflow = checked]; - v546 = arith.constant 4 : u32; - v143 = arith.mod v141, v546 : u32; - hir.assertz v143 #[code = 250]; - v144 = hir.int_to_ptr v141 : ptr; - v145 = hir.load v144 : i32; - v147 = arith.constant 52 : u32; - v146 = hir.bitcast v494 : u32; - v148 = arith.add v146, v147 : u32 #[overflow = checked]; - v545 = arith.constant 4 : u32; - v150 = arith.mod v148, v545 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : i32; - v154 = arith.constant 56 : u32; - v153 = hir.bitcast v494 : u32; - v155 = arith.add v153, v154 : u32 #[overflow = checked]; - v544 = arith.constant 4 : u32; - v157 = arith.mod v155, v544 : u32; - hir.assertz v157 #[code = 250]; - v158 = hir.int_to_ptr v155 : ptr; - v159 = hir.load v158 : i32; - v161 = arith.constant 60 : u32; - v160 = hir.bitcast v494 : u32; - v162 = arith.add v160, v161 : u32 #[overflow = checked]; - v543 = arith.constant 4 : u32; - v164 = arith.mod v162, v543 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i32; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/std::crypto::hashes::sha256::hash_1to1(v117, v124, v131, v138, v145, v152, v159, v166, v494) - v168 = arith.constant 24 : u32; - v167 = hir.bitcast v494 : u32; - v169 = arith.add v167, v168 : u32 #[overflow = checked]; - v542 = arith.constant 8 : u32; - v171 = arith.mod v169, v542 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - v173 = hir.load v172 : i64; - v541 = arith.constant 56 : u32; - v174 = hir.bitcast v494 : u32; - v176 = arith.add v174, v541 : u32 #[overflow = checked]; - v540 = arith.constant 8 : u32; - v178 = arith.mod v176, v540 : u32; - hir.assertz v178 #[code = 250]; - v179 = hir.int_to_ptr v176 : ptr; - hir.store v179, v173; - v181 = arith.constant 16 : u32; - v180 = hir.bitcast v494 : u32; - v182 = arith.add v180, v181 : u32 #[overflow = checked]; - v539 = arith.constant 8 : u32; - v184 = arith.mod v182, v539 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - v186 = hir.load v185 : i64; - v538 = arith.constant 48 : u32; - v187 = hir.bitcast v494 : u32; - v189 = arith.add v187, v538 : u32 #[overflow = checked]; - v537 = arith.constant 8 : u32; - v191 = arith.mod v189, v537 : u32; - hir.assertz v191 #[code = 250]; - v192 = hir.int_to_ptr v189 : ptr; - hir.store v192, v186; - v536 = arith.constant 8 : u32; - v193 = hir.bitcast v494 : u32; - v195 = arith.add v193, v536 : u32 #[overflow = checked]; - v535 = arith.constant 8 : u32; - v197 = arith.mod v195, v535 : u32; + 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; + 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]; - v198 = hir.int_to_ptr v195 : ptr; - v199 = hir.load v198 : i64; - v534 = arith.constant 40 : u32; - v200 = hir.bitcast v494 : u32; - v202 = arith.add v200, v534 : u32 #[overflow = checked]; - v533 = arith.constant 8 : u32; - v204 = arith.mod v202, v533 : u32; - hir.assertz v204 #[code = 250]; - v205 = hir.int_to_ptr v202 : ptr; - hir.store v205, v199; - v206 = hir.bitcast v494 : u32; - v532 = arith.constant 8 : u32; - v208 = arith.mod v206, v532 : u32; - hir.assertz v208 #[code = 250]; - v209 = hir.int_to_ptr v206 : ptr; - v210 = hir.load v209 : i64; - v531 = arith.constant 32 : u32; - v211 = hir.bitcast v494 : u32; - v213 = arith.add v211, v531 : u32 #[overflow = checked]; - v530 = arith.constant 8 : u32; - v215 = arith.mod v213, v530 : u32; - hir.assertz v215 #[code = 250]; - v216 = hir.int_to_ptr v213 : ptr; - hir.store v216, v210; - v529 = arith.constant 0 : i32; - v466, v467, v468, v469, v470, v471, v472 = scf.while v529, v494, v495, v496 : i32, i32, i32, i32, i32, i32, i32 { - ^block47(v473: i32, v474: i32, v475: i32, v476: i32): - v527 = arith.constant 0 : i32; - v528 = arith.constant 32 : i32; - v220 = arith.eq v473, v528 : i1; - v221 = arith.zext v220 : u32; - v222 = hir.bitcast v221 : i32; - v224 = arith.neq v222, v527 : i1; - v460 = scf.if v224 : i32 { - ^block46: - v526 = ub.poison i32 : i32; - scf.yield v526; + 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: + scf.yield ; } else { - ^block19: - v525 = arith.constant 32 : i32; - v227 = arith.add v474, v525 : i32 #[overflow = wrapping]; - v228 = arith.add v227, v473 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/core::slice::::reverse(v228) - v524 = arith.constant 4 : i32; - v230 = arith.add v473, v524 : i32 #[overflow = wrapping]; - scf.yield v230; + ^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) + scf.yield ; }; - v519 = ub.poison i32 : i32; - v463 = cf.select v224, v519, v476 : i32; - v520 = ub.poison i32 : i32; - v462 = cf.select v224, v520, v475 : i32; - v521 = ub.poison i32 : i32; - v461 = cf.select v224, v521, v474 : i32; - v522 = arith.constant 1 : u32; - v523 = arith.constant 0 : u32; - v465 = cf.select v224, v523, v522 : u32; - v402 = arith.trunc v465 : i1; - scf.condition v402, v460, v461, v462, v463, v474, v475, v476; + 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; } do { - ^block48(v477: i32, v478: i32, v479: i32, v480: i32, v481: i32, v482: i32, v483: i32): - scf.yield v477, v478, v479, v480; + ^block59(v666: i32, v667: i32, v668: i32, v669: i32, v670: i32, v671: i32): + scf.yield v666, v667, v668; }; - v518 = arith.constant 32 : u32; - v233 = hir.bitcast v470 : u32; - v235 = arith.add v233, v518 : u32 #[overflow = checked]; - v517 = arith.constant 8 : u32; - v237 = arith.mod v235, v517 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : i64; - v240 = hir.bitcast v471 : u32; - v241 = hir.int_to_ptr v240 : ptr; - hir.store v241, v239; - v516 = arith.constant 56 : u32; - v244 = hir.bitcast v470 : u32; - v246 = arith.add v244, v516 : u32 #[overflow = checked]; - v515 = arith.constant 8 : u32; - v248 = arith.mod v246, v515 : u32; - hir.assertz v248 #[code = 250]; - v249 = hir.int_to_ptr v246 : ptr; - v250 = hir.load v249 : i64; - v514 = arith.constant 24 : i32; - v243 = arith.add v471, v514 : i32 #[overflow = wrapping]; - v251 = hir.bitcast v243 : u32; - v252 = hir.int_to_ptr v251 : ptr; - hir.store v252, v250; - v513 = arith.constant 48 : u32; - v255 = hir.bitcast v470 : u32; - v257 = arith.add v255, v513 : u32 #[overflow = checked]; - v512 = arith.constant 8 : u32; - v259 = arith.mod v257, v512 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - v261 = hir.load v260 : i64; - v511 = arith.constant 16 : i32; - v254 = arith.add v471, v511 : i32 #[overflow = wrapping]; - v262 = hir.bitcast v254 : u32; - v263 = hir.int_to_ptr v262 : ptr; - hir.store v263, v261; - v510 = arith.constant 40 : u32; - v266 = hir.bitcast v470 : u32; - v268 = arith.add v266, v510 : u32 #[overflow = checked]; - v509 = arith.constant 8 : u32; - v270 = arith.mod v268, v509 : u32; + 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 : i64; - v508 = arith.constant 8 : i32; - v265 = arith.add v471, v508 : i32 #[overflow = wrapping]; - v273 = hir.bitcast v265 : u32; - v274 = hir.int_to_ptr v273 : ptr; - hir.store v274, v272; - v277 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr - v278 = hir.bitcast v277 : ptr; - hir.store v278, v472; + 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; + 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: + 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) + 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; + } do { + ^block57(v646: i32, v647: i32, v648: i32, v649: i32, v650: i32, v651: i32): + scf.yield v646, v647, v648; + }; + 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; builtin.ret ; }; - private builtin.function @std::crypto::hashes::sha256::hash_1to1(v279: i32, v280: i32, v281: i32, v282: i32, v283: i32, v284: i32, v285: i32, v286: i32, v287: i32) { - ^block20(v279: i32, v280: i32, v281: i32, v282: i32, v283: i32, v284: i32, v285: i32, v286: i32, v287: i32): - v288, v289, v290, v291, v292, v293, v294, v295 = hir.exec @std/crypto/hashes/sha256/hash_1to1(v279, v280, v281, v282, v283, v284, v285, v286) : i32, i32, i32, i32, i32, i32, i32, i32 - v296 = hir.bitcast v287 : u32; - v297 = hir.int_to_ptr v296 : ptr; - hir.store v297, v288; - v298 = arith.constant 4 : u32; - v299 = arith.add v296, v298 : u32 #[overflow = checked]; - v300 = hir.int_to_ptr v299 : ptr; - hir.store v300, v289; - v301 = arith.constant 8 : u32; - v302 = arith.add v296, v301 : u32 #[overflow = checked]; - v303 = hir.int_to_ptr v302 : ptr; - hir.store v303, v290; - v304 = arith.constant 12 : u32; - v305 = arith.add v296, v304 : u32 #[overflow = checked]; - v306 = hir.int_to_ptr v305 : ptr; - hir.store v306, v291; - v307 = arith.constant 16 : u32; - v308 = arith.add v296, v307 : u32 #[overflow = checked]; - v309 = hir.int_to_ptr v308 : ptr; - hir.store v309, v292; - v310 = arith.constant 20 : u32; - v311 = arith.add v296, v310 : u32 #[overflow = checked]; - v312 = hir.int_to_ptr v311 : ptr; - hir.store v312, v293; - v313 = arith.constant 24 : u32; - v314 = arith.add v296, v313 : u32 #[overflow = checked]; - v315 = hir.int_to_ptr v314 : ptr; - hir.store v315, v294; - v316 = arith.constant 28 : u32; - v317 = arith.add v296, v316 : u32 #[overflow = checked]; - v318 = hir.int_to_ptr v317 : ptr; - hir.store v318, v295; + 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; 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 217b59310..90430e448 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm @@ -13,35 +13,40 @@ end # mod root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash @callconv("C") -proc core::slice::::reverse( +proc <[u8]>::reverse( + i32, i32 ) - push.3 - dup.1 + push.4294967295 + dup.2 + dup.2 u32wrapping_add - push.0 + u32wrapping_add + push.1 + movup.3 + swap.1 + u32shr movup.2 swap.1 push.1 while.true push.0 - push.2 + push.0 dup.2 eq neq dup.0 if.true - movup.3 - movup.2 + movdn.3 + drop drop drop push.3735929054 dup.0 + dup.1 + swap.2 else dup.2 - dup.2 - u32wrapping_add - dup.0 u32divmod.4 swap.1 swap.1 @@ -55,7 +60,7 @@ proc core::slice::::reverse( drop push.255 u32and - dup.5 + dup.4 u32divmod.4 swap.1 swap.1 @@ -71,7 +76,7 @@ proc core::slice::::reverse( u32and push.255 u32and - movup.2 + dup.4 u32divmod.4 swap.1 dup.0 @@ -121,23 +126,18 @@ proc core::slice::::reverse( movup.4 u32wrapping_add push.1 - movup.3 + movup.4 + u32wrapping_add + push.4294967295 + movup.4 u32wrapping_add end - push.3735929054 - dup.3 - movup.2 - swap.5 - movdn.2 - cdrop push.1 push.0 - movup.4 + movup.5 cdrop push.1 u32and - movup.3 - swap.1 if.true push.1 else @@ -149,6 +149,169 @@ proc core::slice::::reverse( drop end +@callconv("C") +proc as core::iter::traits::iterator::Iterator>::next( + i32, + i32 +) + push.16 + 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 + push.0 + push.0 + dup.2 + eq + neq + if.true + movup.3 + swap.1 + drop + drop + push.0 + else + push.12 + dup.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 + push.0 + dup.3 + dup.2 + swap.1 + u32lt + neq + dup.0 + if.true + movup.5 + movup.2 + drop + drop + else + push.12 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.4 + u32wrapping_sub + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + movup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + dup.4 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.0 + swap.1 + cdrop + end + push.4 + dup.3 + 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 + 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") pub proc entrypoint(i32, i32) push.1114112 @@ -160,7 +323,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.4294967264 - push.64 + push.128 dup.2 swap.1 u32wrapping_sub @@ -187,7 +350,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.24 - push.32 + push.64 dup.4 u32wrapping_add u32wrapping_add @@ -218,7 +381,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.16 - push.32 + push.64 dup.4 u32wrapping_add u32wrapping_add @@ -249,7 +412,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.8 - push.32 + push.64 dup.4 u32wrapping_add u32wrapping_add @@ -277,7 +440,7 @@ pub proc entrypoint(i32, i32) trace.252 nop swap.1 - push.32 + push.64 dup.3 add u32assert @@ -296,14 +459,123 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + push.44 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.32 + push.4 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.36 + 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.32 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.96 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.40 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.64 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop movup.2 - swap.3 - movdn.2 + swap.1 push.1 while.true - push.0 push.32 + dup.1 + u32wrapping_add + push.24 + dup.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 + 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_sw + trace.252 + nop + push.0 + push.0 dup.2 eq neq @@ -311,54 +583,61 @@ pub proc entrypoint(i32, i32) if.true swap.1 drop - push.3735929054 else - push.32 + push.28 dup.3 - u32wrapping_add - dup.2 - u32wrapping_add + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::core::slice::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 movup.2 - u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::<[u8]>::reverse + trace.252 + nop end push.3735929054 - dup.2 - dup.6 + dup.1 + dup.5 swap.2 swap.1 cdrop push.3735929054 - dup.3 - dup.6 + dup.2 + dup.5 swap.2 swap.1 cdrop push.3735929054 - dup.4 - dup.6 + dup.3 + dup.5 swap.2 swap.1 cdrop push.1 push.0 - movup.6 + movup.5 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.4 + movup.3 drop - movup.4 + movup.3 drop - movup.4 + movup.3 drop push.1 else @@ -368,8 +647,7 @@ pub proc entrypoint(i32, i32) drop drop drop - drop - push.32 + push.64 dup.1 add u32assert @@ -386,7 +664,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.36 + push.68 dup.2 add u32assert @@ -403,7 +681,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.40 + push.72 dup.3 add u32assert @@ -420,7 +698,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.44 + push.76 dup.4 add u32assert @@ -437,7 +715,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.80 dup.5 add u32assert @@ -454,7 +732,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.52 + push.84 dup.6 add u32assert @@ -471,7 +749,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.56 + push.88 dup.7 add u32assert @@ -488,7 +766,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.60 + push.92 dup.8 add u32assert @@ -505,7 +783,9 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - dup.8 + push.32 + dup.9 + u32wrapping_add movup.3 swap.5 movdn.3 @@ -521,7 +801,7 @@ pub proc entrypoint(i32, i32) exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::std::crypto::hashes::sha256::hash_1to1 trace.252 nop - push.24 + push.56 dup.1 add u32assert @@ -539,7 +819,7 @@ pub proc entrypoint(i32, i32) trace.252 nop swap.1 - push.56 + push.88 dup.3 add u32assert @@ -558,7 +838,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.16 + push.48 dup.1 add u32assert @@ -576,7 +856,7 @@ pub proc entrypoint(i32, i32) trace.252 nop swap.1 - push.48 + push.80 dup.3 add u32assert @@ -595,7 +875,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.8 + push.40 dup.1 add u32assert @@ -613,7 +893,7 @@ pub proc entrypoint(i32, i32) trace.252 nop swap.1 - push.40 + push.72 dup.3 add u32assert @@ -632,7 +912,10 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - dup.0 + push.32 + dup.1 + add + u32assert push.8 dup.1 swap.1 @@ -647,7 +930,7 @@ pub proc entrypoint(i32, i32) trace.252 nop swap.1 - push.32 + push.64 dup.3 add u32assert @@ -666,11 +949,121 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + push.120 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.32 + push.4 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.112 + 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.108 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.96 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.116 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.64 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true + push.108 + dup.1 + u32wrapping_add + push.16 + dup.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 + 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_sw + trace.252 + nop + push.0 push.0 - push.32 dup.2 eq neq @@ -678,54 +1071,61 @@ pub proc entrypoint(i32, i32) if.true swap.1 drop - push.3735929054 else - push.32 + push.20 dup.3 - u32wrapping_add - dup.2 - u32wrapping_add + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::core::slice::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 movup.2 - u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::<[u8]>::reverse + trace.252 + nop end push.3735929054 - dup.2 - dup.6 + dup.1 + dup.5 swap.2 swap.1 cdrop push.3735929054 - dup.3 - dup.6 + dup.2 + dup.5 swap.2 swap.1 cdrop push.3735929054 - dup.4 - dup.6 + dup.3 + dup.5 swap.2 swap.1 cdrop push.1 push.0 - movup.6 + movup.5 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.4 + movup.3 drop - movup.4 + movup.3 drop - movup.4 + movup.3 drop push.1 else @@ -735,8 +1135,7 @@ pub proc entrypoint(i32, i32) drop drop drop - drop - push.32 + push.64 dup.1 add u32assert @@ -764,7 +1163,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.56 + push.88 dup.1 add u32assert @@ -794,7 +1193,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.48 + push.80 dup.1 add u32assert @@ -824,7 +1223,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.40 + push.72 swap.1 add u32assert diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat index 6b99cc657..10c5962e1 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat @@ -1,65 +1,107 @@ (module $rust_sdk_stdlib_sha256_hash.wasm - (type (;0;) (func (param i32))) - (type (;1;) (func (param i32 i32))) - (type (;2;) (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32))) + (type (;0;) (func (param i32 i32))) + (type (;1;) (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $core::slice::::reverse (;0;) (type 0) (param i32) - (local i32 i32 i32 i32) + (func $<[u8]>::reverse (;0;) (type 0) (param i32 i32) + (local i32 i32) + local.get 1 + i32.const 1 + i32.shr_u + local.set 2 + local.get 1 local.get 0 - i32.const 3 + i32.add + i32.const -1 i32.add local.set 1 - i32.const 0 - local.set 2 block ;; label = @1 loop ;; label = @2 local.get 2 - i32.const 2 - i32.eq + i32.eqz br_if 1 (;@1;) local.get 0 - local.get 2 - i32.add - local.tee 3 i32.load8_u - local.set 4 - local.get 3 + local.set 3 + local.get 0 local.get 1 i32.load8_u i32.store8 local.get 1 - local.get 4 + local.get 3 i32.store8 - local.get 1 + local.get 2 i32.const -1 i32.add - local.set 1 - local.get 2 + local.set 2 + local.get 0 i32.const 1 i32.add - local.set 2 + local.set 0 + local.get 1 + i32.const -1 + i32.add + local.set 1 br 0 (;@2;) end end ) - (func $entrypoint (;1;) (type 1) (param i32 i32) + (func $ as core::iter::traits::iterator::Iterator>::next (;1;) (type 0) (param i32 i32) + (local i32 i32 i32 i32) + local.get 1 + i32.load offset=16 + local.set 2 + i32.const 0 + local.set 3 + block ;; label = @1 + local.get 1 + i32.load offset=8 + local.tee 4 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load offset=12 + local.tee 5 + local.get 2 + i32.lt_u + br_if 0 (;@1;) + local.get 1 + local.get 5 + local.get 2 + i32.sub + i32.store offset=12 + local.get 1 + local.get 4 + local.get 2 + i32.add + i32.store offset=8 + local.get 4 + local.set 3 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 3 + i32.store + ) + (func $entrypoint (;2;) (type 0) (param i32 i32) (local i32 i32) global.get $__stack_pointer local.tee 2 local.set 3 local.get 2 - i32.const 64 + i32.const 128 i32.sub i32.const -32 i32.and local.tee 2 global.set $__stack_pointer local.get 2 - i32.const 32 + i32.const 64 i32.add i32.const 24 i32.add @@ -69,7 +111,7 @@ i64.load align=1 i64.store local.get 2 - i32.const 32 + i32.const 64 i32.add i32.const 16 i32.add @@ -79,7 +121,7 @@ i64.load align=1 i64.store local.get 2 - i32.const 32 + i32.const 64 i32.add i32.const 8 i32.add @@ -91,109 +133,143 @@ local.get 2 local.get 1 i64.load align=1 - i64.store offset=32 + i64.store offset=64 + local.get 2 + i64.const 17179869216 + i64.store offset=44 align=4 + local.get 2 i32.const 0 - local.set 1 + i32.store offset=36 + local.get 2 + local.get 2 + i32.const 96 + i32.add + i32.store offset=32 + local.get 2 + local.get 2 + i32.const 64 + i32.add + i32.store offset=40 block ;; label = @1 loop ;; label = @2 - local.get 1 - i32.const 32 - i32.eq - br_if 1 (;@1;) local.get 2 - i32.const 32 + i32.const 24 i32.add - local.get 1 + local.get 2 + i32.const 32 i32.add - call $core::slice::::reverse + call $ as core::iter::traits::iterator::Iterator>::next + local.get 2 + i32.load offset=24 + local.tee 1 + i32.eqz + br_if 1 (;@1;) local.get 1 - i32.const 4 - i32.add - local.set 1 + local.get 2 + i32.load offset=28 + call $<[u8]>::reverse br 0 (;@2;) end end local.get 2 - i32.load offset=32 + i32.load offset=64 local.get 2 - i32.load offset=36 + i32.load offset=68 local.get 2 - i32.load offset=40 + i32.load offset=72 local.get 2 - i32.load offset=44 + i32.load offset=76 local.get 2 - i32.load offset=48 + i32.load offset=80 local.get 2 - i32.load offset=52 + i32.load offset=84 local.get 2 - i32.load offset=56 + i32.load offset=88 local.get 2 - i32.load offset=60 + i32.load offset=92 local.get 2 + i32.const 32 + i32.add call $std::crypto::hashes::sha256::hash_1to1 local.get 2 local.get 2 - i64.load offset=24 - i64.store offset=56 + i64.load offset=56 + i64.store offset=88 + local.get 2 + local.get 2 + i64.load offset=48 + i64.store offset=80 local.get 2 local.get 2 - i64.load offset=16 - i64.store offset=48 + i64.load offset=40 + i64.store offset=72 local.get 2 local.get 2 - i64.load offset=8 - i64.store offset=40 + i64.load offset=32 + i64.store offset=64 local.get 2 + i64.const 17179869216 + i64.store offset=120 align=4 local.get 2 - i64.load - i64.store offset=32 i32.const 0 - local.set 1 + i32.store offset=112 + local.get 2 + local.get 2 + i32.const 96 + i32.add + i32.store offset=108 + local.get 2 + local.get 2 + i32.const 64 + i32.add + i32.store offset=116 block ;; label = @1 loop ;; label = @2 - local.get 1 - i32.const 32 - i32.eq - br_if 1 (;@1;) local.get 2 - i32.const 32 + i32.const 16 i32.add - local.get 1 + local.get 2 + i32.const 108 i32.add - call $core::slice::::reverse + call $ as core::iter::traits::iterator::Iterator>::next + local.get 2 + i32.load offset=16 + local.tee 1 + i32.eqz + br_if 1 (;@1;) local.get 1 - i32.const 4 - i32.add - local.set 1 + local.get 2 + i32.load offset=20 + call $<[u8]>::reverse br 0 (;@2;) end end local.get 0 local.get 2 - i64.load offset=32 + i64.load offset=64 i64.store align=1 local.get 0 i32.const 24 i32.add local.get 2 - i64.load offset=56 + i64.load offset=88 i64.store align=1 local.get 0 i32.const 16 i32.add local.get 2 - i64.load offset=48 + i64.load offset=80 i64.store align=1 local.get 0 i32.const 8 i32.add local.get 2 - i64.load offset=40 + i64.load offset=72 i64.store align=1 local.get 3 global.set $__stack_pointer ) - (func $std::crypto::hashes::sha256::hash_1to1 (;2;) (type 2) (param i32 i32 i32 i32 i32 i32 i32 i32 i32) + (func $std::crypto::hashes::sha256::hash_1to1 (;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 e89520719..c375d59cc 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.hir +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.hir @@ -9,8 +9,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : felt; v10 = hir.bitcast v1 : u32; - v404 = arith.constant 4 : u32; - v12 = arith.mod v10, v404 : 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; @@ -21,98 +21,98 @@ builtin.component root_ns:root@1.0.0 { v18 = arith.zext v17 : u32; v19 = hir.bitcast v18 : i32; v21 = arith.neq v19, v3 : i1; - v382 = scf.if v21 : i32 { + v410 = scf.if v21 : i32 { ^block6: - v403 = arith.constant 0 : i32; - scf.yield v403; + v431 = arith.constant 0 : i32; + scf.yield v431; } else { ^block7: - v402 = arith.constant 4 : u32; + v430 = arith.constant 4 : u32; v22 = hir.bitcast v0 : u32; - v24 = arith.add v22, v402 : u32 #[overflow = checked]; - v401 = arith.constant 4 : u32; - v26 = arith.mod v24, v401 : 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; - v400 = arith.constant 4 : u32; + v428 = arith.constant 4 : u32; v29 = hir.bitcast v1 : u32; - v31 = arith.add v29, v400 : u32 #[overflow = checked]; - v399 = arith.constant 4 : u32; - v33 = arith.mod v31, v399 : 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 - v397 = arith.constant 0 : i32; - v398 = arith.constant 1 : i32; - v38 = arith.neq v36, v398 : i1; + 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, v397 : i1; - v384 = scf.if v42 : i32 { + v42 = arith.neq v40, v425 : i1; + v412 = scf.if v42 : i32 { ^block31: - v396 = arith.constant 0 : i32; - scf.yield v396; + v424 = arith.constant 0 : i32; + scf.yield v424; } else { ^block8: v44 = arith.constant 8 : u32; v43 = hir.bitcast v0 : u32; v45 = arith.add v43, v44 : u32 #[overflow = checked]; - v395 = arith.constant 4 : u32; - v47 = arith.mod v45, v395 : u32; + 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; - v394 = arith.constant 8 : u32; + v422 = arith.constant 8 : u32; v50 = hir.bitcast v1 : u32; - v52 = arith.add v50, v394 : u32 #[overflow = checked]; - v393 = arith.constant 4 : u32; - v54 = arith.mod v52, v393 : 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 - v391 = arith.constant 0 : i32; - v392 = arith.constant 1 : i32; - v59 = arith.neq v57, v392 : i1; + 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, v391 : i1; - v385 = scf.if v63 : i32 { + v63 = arith.neq v61, v419 : i1; + v413 = scf.if v63 : i32 { ^block30: - v390 = arith.constant 0 : i32; - scf.yield v390; + v418 = arith.constant 0 : i32; + scf.yield v418; } else { ^block9: v65 = arith.constant 12 : u32; v64 = hir.bitcast v0 : u32; v66 = arith.add v64, v65 : u32 #[overflow = checked]; - v389 = arith.constant 4 : u32; - v68 = arith.mod v66, v389 : u32; + 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; - v388 = arith.constant 12 : u32; + v416 = arith.constant 12 : u32; v71 = hir.bitcast v1 : u32; - v73 = arith.add v71, v388 : u32 #[overflow = checked]; - v387 = arith.constant 4 : u32; - v75 = arith.mod v73, v387 : 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 - v386 = arith.constant 1 : i32; - v80 = arith.eq v78, v386 : i1; + v414 = arith.constant 1 : i32; + v80 = arith.eq v78, v414 : i1; v81 = arith.zext v80 : u32; v82 = hir.bitcast v81 : i32; scf.yield v82; }; - scf.yield v385; + scf.yield v413; }; - scf.yield v384; + scf.yield v412; }; - builtin.ret v382; + builtin.ret v410; }; public builtin.function @entrypoint(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt) { @@ -121,7 +121,7 @@ builtin.component root_ns:root@1.0.0 { v94 = hir.bitcast v93 : ptr; v95 = hir.load v94 : i32; v98 = arith.constant -32 : i32; - v96 = arith.constant 128 : 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 @@ -138,24 +138,24 @@ builtin.component root_ns:root@1.0.0 { v109 = arith.constant 24 : u32; v108 = hir.bitcast v99 : u32; v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v436 = arith.constant 4 : u32; - v112 = arith.mod v110, v436 : u32; + 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]; - v435 = arith.constant 4 : u32; - v118 = arith.mod v116, v435 : u32; + 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]; - v434 = arith.constant 4 : u32; - v124 = arith.mod v122, v434 : u32; + 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; @@ -170,336 +170,370 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v132 #[code = 250]; v133 = hir.int_to_ptr v130 : ptr; v134 = hir.load v133 : i64; - v136 = arith.constant 104 : u32; + v136 = arith.constant 120 : u32; v135 = hir.bitcast v99 : u32; v137 = arith.add v135, v136 : u32 #[overflow = checked]; - v433 = arith.constant 8 : u32; - v139 = arith.mod v137, v433 : u32; + 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]; - v432 = arith.constant 8 : u32; - v145 = arith.mod v143, v432 : u32; + 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 96 : u32; + v149 = arith.constant 112 : u32; v148 = hir.bitcast v99 : u32; v150 = arith.add v148, v149 : u32 #[overflow = checked]; - v431 = arith.constant 8 : u32; - v152 = arith.mod v150, v431 : u32; + 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]; - v430 = arith.constant 8 : u32; - v158 = arith.mod v156, v430 : u32; + 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 120 : u32; + v162 = arith.constant 136 : u32; v161 = hir.bitcast v99 : u32; v163 = arith.add v161, v162 : u32 #[overflow = checked]; - v429 = arith.constant 8 : u32; - v165 = arith.mod v163, v429 : u32; + 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]; - v428 = arith.constant 8 : u32; - v171 = arith.mod v169, v428 : u32; + 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 112 : u32; + v175 = arith.constant 128 : u32; v174 = hir.bitcast v99 : u32; v176 = arith.add v174, v175 : u32 #[overflow = checked]; - v427 = arith.constant 8 : u32; - v178 = arith.mod v176, v427 : u32; + 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 96 : i32; + 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v181, v183) - v184 = arith.constant 48 : i32; - v185 = arith.add v99, v184 : i32 #[overflow = wrapping]; - v186 = arith.constant 112 : i32; + 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]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/miden_stdlib_sys::intrinsics::word::Word::reverse(v185, v187) - v188 = arith.constant 10 : i64; - v189 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v188) : felt - v190 = arith.constant 11 : i64; - v191 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v190) : felt - v192 = arith.constant 12 : i64; - v193 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v192) : felt - v194 = arith.constant 13 : i64; - v195 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v194) : felt - v197 = arith.constant 76 : u32; - v196 = hir.bitcast v99 : u32; - v198 = arith.add v196, v197 : u32 #[overflow = checked]; - v426 = arith.constant 4 : u32; - v200 = arith.mod v198, v426 : u32; - hir.assertz v200 #[code = 250]; - v201 = hir.int_to_ptr v198 : ptr; - hir.store v201, v195; - v425 = arith.constant 72 : u32; - v202 = hir.bitcast v99 : u32; - v204 = arith.add v202, v425 : u32 #[overflow = checked]; - v424 = arith.constant 4 : u32; - v206 = arith.mod v204, v424 : u32; - hir.assertz v206 #[code = 250]; - v207 = hir.int_to_ptr v204 : ptr; - hir.store v207, v193; - v209 = arith.constant 68 : u32; + 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]; - v423 = arith.constant 4 : u32; - v212 = arith.mod v210, v423 : u32; + 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, v191; - v422 = arith.constant 64 : u32; - v214 = hir.bitcast v99 : u32; - v216 = arith.add v214, v422 : u32 #[overflow = checked]; - v421 = arith.constant 4 : u32; - v218 = arith.mod v216, v421 : u32; - hir.assertz v218 #[code = 250]; - v219 = hir.int_to_ptr v216 : ptr; - hir.store v219, v189; - v419 = arith.constant 64 : i32; - v223 = arith.add v99, v419 : i32 #[overflow = wrapping]; - v420 = arith.constant 32 : i32; - v221 = arith.add v99, v420 : i32 #[overflow = wrapping]; - v224 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v221, v223) : i32 - v418 = arith.constant 0 : i32; + 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; + hir.assertz v244 #[code = 250]; + 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; - v226 = arith.eq v224, v92 : i1; - v227 = arith.zext v226 : u32; - v228 = hir.bitcast v227 : i32; - v230 = arith.neq v228, v418 : i1; - v409 = scf.if v230 : u32 { + 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: - v405 = arith.constant 0 : u32; - scf.yield v405; + v433 = arith.constant 0 : u32; + scf.yield v433; } else { ^block13: - v231 = arith.constant 16 : i32; - v232 = arith.add v99, v231 : i32 #[overflow = wrapping]; - v233 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v185, v232) : i32 - v416 = arith.constant 0 : i32; - v417 = arith.constant 0 : i32; - v235 = arith.eq v233, v417 : i1; - v236 = arith.zext v235 : u32; - v237 = hir.bitcast v236 : i32; - v239 = arith.neq v237, v416 : i1; - scf.if v239{ + 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: scf.yield ; } else { ^block14: - v240 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr - v241 = hir.bitcast v240 : ptr; - hir.store v241, v95; + 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; scf.yield ; }; - v407 = arith.constant 1 : u32; - v415 = arith.constant 0 : u32; - v413 = cf.select v239, v415, v407 : u32; - scf.yield v413; + v435 = arith.constant 1 : u32; + v443 = arith.constant 0 : u32; + v441 = cf.select v267, v443, v435 : u32; + scf.yield v441; }; - v414 = arith.constant 0 : u32; - v412 = arith.eq v409, v414 : i1; - cf.cond_br v412 ^block12, ^block38; + v442 = arith.constant 0 : u32; + v440 = arith.eq v437, v442 : i1; + cf.cond_br v440 ^block12, ^block38; ^block12: ub.unreachable ; ^block38: builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v242: i32, v243: i32) { - ^block15(v242: i32, v243: i32): - v246 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr - v247 = hir.bitcast v246 : ptr; - v248 = hir.load v247 : i32; - v249 = arith.constant 16 : i32; - v250 = arith.sub v248, v249 : i32 #[overflow = wrapping]; - v252 = arith.constant 8 : u32; - v251 = hir.bitcast v243 : u32; - v253 = arith.add v251, v252 : u32 #[overflow = checked]; - v523 = arith.constant 8 : u32; - v255 = arith.mod v253, v523 : u32; - hir.assertz v255 #[code = 250]; - v256 = hir.int_to_ptr v253 : ptr; - v257 = hir.load v256 : i64; - v522 = arith.constant 8 : u32; - v258 = hir.bitcast v250 : u32; - v260 = arith.add v258, v522 : u32 #[overflow = checked]; - v261 = arith.constant 4 : u32; - v262 = arith.mod v260, v261 : u32; - hir.assertz v262 #[code = 250]; - v263 = hir.int_to_ptr v260 : ptr; - hir.store v263, v257; - v264 = hir.bitcast v243 : u32; - v521 = arith.constant 8 : u32; - v266 = arith.mod v264, v521 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - v268 = hir.load v267 : i64; - v269 = hir.bitcast v250 : u32; - v520 = arith.constant 4 : u32; - v271 = arith.mod v269, v520 : u32; - hir.assertz v271 #[code = 250]; - v272 = hir.int_to_ptr v269 : ptr; - hir.store v272, v268; - v273 = arith.constant 12 : i32; - v274 = arith.add v250, v273 : i32 #[overflow = wrapping]; - v244 = arith.constant 0 : i32; - v491, v492, v493, v494, v495, v496 = scf.while v244, v250, v274, v242 : i32, i32, i32, i32, i32, i32 { - ^block48(v497: i32, v498: i32, v499: i32, v500: i32): - v519 = arith.constant 0 : i32; - v277 = arith.constant 8 : i32; - v278 = arith.eq v497, v277 : i1; - v279 = arith.zext v278 : u32; - v280 = hir.bitcast v279 : i32; - v282 = arith.neq v280, v519 : i1; - v485, v486 = scf.if v282 : i32, i32 { + 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: - v445 = ub.poison i32 : i32; - scf.yield v445, v445; + v477 = ub.poison i32 : i32; + scf.yield v477, v477; } else { ^block20: - v284 = arith.add v498, v497 : i32 #[overflow = wrapping]; - v285 = hir.bitcast v284 : u32; - v518 = arith.constant 4 : u32; - v287 = arith.mod v285, v518 : u32; - hir.assertz v287 #[code = 250]; - v288 = hir.int_to_ptr v285 : ptr; - v289 = hir.load v288 : felt; - v291 = hir.bitcast v499 : u32; - v517 = arith.constant 4 : u32; - v293 = arith.mod v291, v517 : u32; - hir.assertz v293 #[code = 250]; - v294 = hir.int_to_ptr v291 : ptr; - v295 = hir.load v294 : i32; - v296 = hir.bitcast v284 : u32; - v516 = arith.constant 4 : u32; - v298 = arith.mod v296, v516 : u32; - hir.assertz v298 #[code = 250]; - v299 = hir.int_to_ptr v296 : ptr; - hir.store v299, v295; - v300 = hir.bitcast v499 : u32; - v515 = arith.constant 4 : u32; - v302 = arith.mod v300, v515 : u32; - hir.assertz v302 #[code = 250]; - v303 = hir.int_to_ptr v300 : ptr; - hir.store v303, v289; - v306 = arith.constant -4 : i32; - v307 = arith.add v499, v306 : i32 #[overflow = wrapping]; - v304 = arith.constant 4 : i32; - v305 = arith.add v497, v304 : i32 #[overflow = wrapping]; - scf.yield v305, v307; + 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; }; - v513 = ub.poison i32 : i32; - v488 = cf.select v282, v513, v500 : i32; - v514 = ub.poison i32 : i32; - v487 = cf.select v282, v514, v498 : i32; - v444 = arith.constant 1 : u32; - v437 = arith.constant 0 : u32; - v490 = cf.select v282, v437, v444 : u32; - v478 = arith.trunc v490 : i1; - scf.condition v478, v485, v487, v486, v488, v498, v500; + 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(v501: i32, v502: i32, v503: i32, v504: i32, v505: i32, v506: i32): - scf.yield v501, v502, v503, v504; + ^block49(v533: i32, v534: i32, v535: i32, v536: i32, v537: i32, v538: i32): + scf.yield v533, v534, v535, v536; }; - v512 = arith.constant 8 : u32; - v309 = hir.bitcast v495 : u32; - v311 = arith.add v309, v512 : u32 #[overflow = checked]; - v511 = arith.constant 4 : u32; - v313 = arith.mod v311, v511 : u32; - hir.assertz v313 #[code = 250]; - v314 = hir.int_to_ptr v311 : ptr; - v315 = hir.load v314 : i64; - v510 = arith.constant 8 : u32; - v316 = hir.bitcast v496 : u32; - v318 = arith.add v316, v510 : u32 #[overflow = checked]; - v509 = arith.constant 8 : u32; - v320 = arith.mod v318, v509 : u32; - hir.assertz v320 #[code = 250]; - v321 = hir.int_to_ptr v318 : ptr; - hir.store v321, v315; - v322 = hir.bitcast v495 : u32; - v508 = arith.constant 4 : u32; - v324 = arith.mod v322, v508 : u32; - hir.assertz v324 #[code = 250]; - v325 = hir.int_to_ptr v322 : ptr; - v326 = hir.load v325 : i64; - v327 = hir.bitcast v496 : u32; - v507 = arith.constant 8 : u32; - v329 = arith.mod v327, v507 : u32; - hir.assertz v329 #[code = 250]; - v330 = hir.int_to_ptr v327 : ptr; - hir.store v330, v326; + 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; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v331: i64) -> felt { - ^block21(v331: i64): - v332 = hir.cast v331 : felt; - builtin.ret v332; + 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::eq(v334: felt, v335: felt) -> i32 { - ^block23(v334: felt, v335: felt): - v336 = arith.eq v334, v335 : i1; - v337 = hir.cast v336 : i32; - builtin.ret v337; + 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(v339: felt, v340: felt, v341: felt, v342: felt, v343: felt, v344: felt, v345: felt, v346: felt, v347: i32) { - ^block25(v339: felt, v340: felt, v341: felt, v342: felt, v343: felt, v344: felt, v345: felt, v346: felt, v347: i32): - v348, v349, v350, v351, v352, v353, v354, v355 = hir.exec @std/collections/smt/get(v339, v340, v341, v342, v343, v344, v345, v346) : felt, felt, felt, felt, felt, felt, felt, felt - v356 = hir.bitcast v347 : u32; - v357 = hir.int_to_ptr v356 : ptr; - hir.store v357, v348; - v358 = arith.constant 4 : u32; - v359 = arith.add v356, v358 : u32 #[overflow = checked]; - v360 = hir.int_to_ptr v359 : ptr; - hir.store v360, v349; - v361 = arith.constant 8 : u32; - v362 = arith.add v356, v361 : u32 #[overflow = checked]; - v363 = hir.int_to_ptr v362 : ptr; - hir.store v363, v350; - v364 = arith.constant 12 : u32; - v365 = arith.add v356, v364 : u32 #[overflow = checked]; - v366 = hir.int_to_ptr v365 : ptr; - hir.store v366, v351; - v367 = arith.constant 16 : u32; - v368 = arith.add v356, v367 : u32 #[overflow = checked]; - v369 = hir.int_to_ptr v368 : ptr; - hir.store v369, v352; - v370 = arith.constant 20 : u32; - v371 = arith.add v356, v370 : u32 #[overflow = checked]; - v372 = hir.int_to_ptr v371 : ptr; - hir.store v372, v353; - v373 = arith.constant 24 : u32; - v374 = arith.add v356, v373 : u32 #[overflow = checked]; - v375 = hir.int_to_ptr v374 : ptr; - hir.store v375, v354; - v376 = arith.constant 28 : u32; - v377 = arith.add v356, v376 : u32 #[overflow = checked]; - v378 = hir.int_to_ptr v377 : ptr; - hir.store v378, v355; + 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; 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 343eeadaa..2e3674c2a 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm @@ -219,7 +219,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop push.4294967264 - push.128 + push.160 dup.2 swap.1 u32wrapping_sub @@ -346,7 +346,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.104 + push.120 dup.3 add u32assert @@ -383,7 +383,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.96 + push.112 dup.3 add u32assert @@ -420,7 +420,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.120 + push.136 dup.3 add u32assert @@ -457,7 +457,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.112 + push.128 dup.3 add u32assert @@ -476,7 +476,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop - push.96 + push.112 dup.1 u32wrapping_add push.32 @@ -484,19 +484,91 @@ 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::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::reverse trace.252 nop - push.48 + push.128 dup.1 u32wrapping_add - push.112 + push.144 dup.2 u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::reverse + trace.252 + nop + push.152 + 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.56 + dup.3 + u32wrapping_add + 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.144 + 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.48 + 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.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::intrinsics::mem::store_dw trace.252 nop push.10 @@ -528,7 +600,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop push.76 - dup.6 + dup.5 add u32assert push.4 @@ -545,7 +617,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop push.72 - dup.5 + dup.4 add u32assert push.4 @@ -562,7 +634,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop push.68 - dup.4 + dup.3 add u32assert push.4 @@ -579,7 +651,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop push.64 - dup.3 + dup.2 add u32assert push.4 @@ -596,10 +668,10 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop push.64 - dup.2 + dup.1 u32wrapping_add push.32 - dup.3 + dup.2 u32wrapping_add trace.240 nop @@ -612,15 +684,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) eq neq if.true - drop drop drop push.0 else push.16 + dup.1 + u32wrapping_add + push.48 movup.2 u32wrapping_add - swap.1 trace.240 nop exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::eq @@ -663,7 +736,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -939,6 +1012,11 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( 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 @@ -955,11 +1033,6 @@ proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt add end -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - @callconv("C") proc std::collections::smt::get( felt, diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.wat b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat index a91d62f9c..e6dfe33a4 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.wat +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat @@ -2,8 +2,8 @@ (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 i64) (result f32))) - (type (;4;) (func (param f32 f32) (result 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))) (table (;0;) 1 1 funcref) (memory (;0;) 16) @@ -51,12 +51,12 @@ local.get 2 ) (func $entrypoint (;1;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32) - (local i32 i32 i32) + (local i32 i32) global.get $__stack_pointer local.tee 8 local.set 9 local.get 8 - i32.const 128 + i32.const 160 i32.sub i32.const -32 i32.and @@ -89,34 +89,43 @@ local.get 8 local.get 8 i64.load offset=72 - i64.store offset=104 + i64.store offset=120 local.get 8 local.get 8 i64.load offset=64 - i64.store offset=96 + i64.store offset=112 local.get 8 local.get 8 i64.load offset=88 - i64.store offset=120 + i64.store offset=136 local.get 8 local.get 8 i64.load offset=80 - i64.store offset=112 + i64.store offset=128 local.get 8 i32.const 32 i32.add local.get 8 - i32.const 96 + i32.const 112 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 8 - i32.const 48 + i32.const 144 i32.add - local.tee 10 local.get 8 - i32.const 112 + i32.const 128 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse + local.get 8 + i32.const 56 + i32.add + local.get 8 + i64.load offset=152 + i64.store + local.get 8 + local.get 8 + i64.load offset=144 + i64.store offset=48 i64.const 10 call $intrinsics::felt::from_u64_unchecked local.set 7 @@ -149,7 +158,9 @@ call $::eq i32.eqz br_if 0 (;@1;) - local.get 10 + local.get 8 + i32.const 48 + i32.add local.get 8 i32.const 16 i32.add @@ -162,7 +173,7 @@ end unreachable ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;2;) (type 2) (param i32 i32) + (func $::reverse (;2;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -220,10 +231,10 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) + (func $intrinsics::felt::eq (;3;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;4;) (type 4) (param f32 f32) (result i32) + (func $intrinsics::felt::from_u64_unchecked (;4;) (type 4) (param i64) (result f32) unreachable ) (func $std::collections::smt::get (;5;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32 i32) diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.hir b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir index ba7a499f4..b6acd4d09 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.hir +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir @@ -9,8 +9,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : felt; v10 = hir.bitcast v1 : u32; - v416 = arith.constant 4 : u32; - v12 = arith.mod v10, v416 : 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; @@ -21,98 +21,98 @@ builtin.component root_ns:root@1.0.0 { v18 = arith.zext v17 : u32; v19 = hir.bitcast v18 : i32; v21 = arith.neq v19, v3 : i1; - v394 = scf.if v21 : i32 { + v422 = scf.if v21 : i32 { ^block6: - v415 = arith.constant 0 : i32; - scf.yield v415; + v443 = arith.constant 0 : i32; + scf.yield v443; } else { ^block7: - v414 = arith.constant 4 : u32; + v442 = arith.constant 4 : u32; v22 = hir.bitcast v0 : u32; - v24 = arith.add v22, v414 : u32 #[overflow = checked]; - v413 = arith.constant 4 : u32; - v26 = arith.mod v24, v413 : 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; - v412 = arith.constant 4 : u32; + v440 = arith.constant 4 : u32; v29 = hir.bitcast v1 : u32; - v31 = arith.add v29, v412 : u32 #[overflow = checked]; - v411 = arith.constant 4 : u32; - v33 = arith.mod v31, v411 : 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 - v409 = arith.constant 0 : i32; - v410 = arith.constant 1 : i32; - v38 = arith.neq v36, v410 : i1; + 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, v409 : i1; - v396 = scf.if v42 : i32 { + v42 = arith.neq v40, v437 : i1; + v424 = scf.if v42 : i32 { ^block31: - v408 = arith.constant 0 : i32; - scf.yield v408; + v436 = arith.constant 0 : i32; + scf.yield v436; } else { ^block8: v44 = arith.constant 8 : u32; v43 = hir.bitcast v0 : u32; v45 = arith.add v43, v44 : u32 #[overflow = checked]; - v407 = arith.constant 4 : u32; - v47 = arith.mod v45, v407 : u32; + 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; - v406 = arith.constant 8 : u32; + v434 = arith.constant 8 : u32; v50 = hir.bitcast v1 : u32; - v52 = arith.add v50, v406 : u32 #[overflow = checked]; - v405 = arith.constant 4 : u32; - v54 = arith.mod v52, v405 : 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 - v403 = arith.constant 0 : i32; - v404 = arith.constant 1 : i32; - v59 = arith.neq v57, v404 : i1; + 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, v403 : i1; - v397 = scf.if v63 : i32 { + v63 = arith.neq v61, v431 : i1; + v425 = scf.if v63 : i32 { ^block30: - v402 = arith.constant 0 : i32; - scf.yield v402; + v430 = arith.constant 0 : i32; + scf.yield v430; } else { ^block9: v65 = arith.constant 12 : u32; v64 = hir.bitcast v0 : u32; v66 = arith.add v64, v65 : u32 #[overflow = checked]; - v401 = arith.constant 4 : u32; - v68 = arith.mod v66, v401 : u32; + 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; - v400 = arith.constant 12 : u32; + v428 = arith.constant 12 : u32; v71 = hir.bitcast v1 : u32; - v73 = arith.add v71, v400 : u32 #[overflow = checked]; - v399 = arith.constant 4 : u32; - v75 = arith.mod v73, v399 : 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 - v398 = arith.constant 1 : i32; - v80 = arith.eq v78, v398 : i1; + v426 = arith.constant 1 : i32; + v80 = arith.eq v78, v426 : i1; v81 = arith.zext v80 : u32; v82 = hir.bitcast v81 : i32; scf.yield v82; }; - scf.yield v397; + scf.yield v425; }; - scf.yield v396; + scf.yield v424; }; - builtin.ret v394; + builtin.ret v422; }; 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) { @@ -121,7 +121,7 @@ builtin.component root_ns:root@1.0.0 { v98 = hir.bitcast v97 : ptr; v99 = hir.load v98 : i32; v102 = arith.constant -32 : i32; - v100 = arith.constant 96 : 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 @@ -138,372 +138,406 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v112 #[code = 250]; v113 = hir.int_to_ptr v110 : ptr; v114 = hir.load v113 : i64; - v116 = arith.constant 72 : u32; + v116 = arith.constant 88 : u32; v115 = hir.bitcast v103 : u32; v117 = arith.add v115, v116 : u32 #[overflow = checked]; - v453 = arith.constant 8 : u32; - v119 = arith.mod v117, v453 : u32; + 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]; - v452 = arith.constant 8 : u32; - v125 = arith.mod v123, v452 : u32; + 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 64 : u32; + v129 = arith.constant 80 : u32; v128 = hir.bitcast v103 : u32; v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v451 = arith.constant 8 : u32; - v132 = arith.mod v130, v451 : u32; + 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]; - v450 = arith.constant 8 : u32; - v138 = arith.mod v136, v450 : u32; + 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 88 : u32; + v142 = arith.constant 104 : u32; v141 = hir.bitcast v103 : u32; v143 = arith.add v141, v142 : u32 #[overflow = checked]; - v449 = arith.constant 8 : u32; - v145 = arith.mod v143, v449 : u32; + v481 = arith.constant 8 : u32; + v145 = arith.mod v143, v481 : 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]; - v448 = arith.constant 8 : u32; - v151 = arith.mod v149, v448 : u32; + 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 80 : u32; + v155 = arith.constant 96 : u32; v154 = hir.bitcast v103 : u32; v156 = arith.add v154, v155 : u32 #[overflow = checked]; - v447 = arith.constant 8 : u32; - v158 = arith.mod v156, v447 : u32; + 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 64 : i32; + 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/miden_stdlib_sys::intrinsics::word::Word::reverse(v103, v161) - v162 = arith.constant 16 : i32; - v163 = arith.add v103, v162 : i32 #[overflow = wrapping]; - v164 = arith.constant 80 : i32; + 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]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/miden_stdlib_sys::intrinsics::word::Word::reverse(v163, v165) - v166 = arith.constant 0 : i64; - v167 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v166) : felt - v446 = arith.constant 0 : i64; - v169 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v446) : felt - v445 = arith.constant 0 : i64; - v171 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v445) : felt - v444 = arith.constant 0 : i64; - v173 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v444) : felt - v175 = arith.constant 92 : u32; - v174 = hir.bitcast v103 : u32; - v176 = arith.add v174, v175 : u32 #[overflow = checked]; - v177 = arith.constant 4 : u32; - v178 = arith.mod v176, v177 : u32; - hir.assertz v178 #[code = 250]; - v179 = hir.int_to_ptr v176 : ptr; - hir.store v179, v173; - v443 = arith.constant 88 : u32; - v180 = hir.bitcast v103 : u32; - v182 = arith.add v180, v443 : u32 #[overflow = checked]; - v442 = arith.constant 4 : u32; - v184 = arith.mod v182, v442 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - hir.store v185, v171; - v187 = arith.constant 84 : u32; + 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; + hir.assertz v172 #[code = 250]; + 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.assertz v183 #[code = 250]; + 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]; - v441 = arith.constant 4 : u32; - v190 = arith.mod v188, v441 : u32; + 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, v169; - v440 = arith.constant 80 : u32; - v192 = hir.bitcast v103 : u32; - v194 = arith.add v192, v440 : u32 #[overflow = checked]; - v439 = arith.constant 4 : u32; - v196 = arith.mod v194, v439 : u32; - hir.assertz v196 #[code = 250]; - v197 = hir.int_to_ptr v194 : ptr; - hir.store v197, v167; - v198 = arith.constant -8162549007765693629 : i64; - v199 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v198) : felt - v200 = arith.constant 2968936853898945160 : i64; - v201 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v200) : felt - v202 = arith.constant 4556576161526575002 : i64; - v203 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v202) : felt - v204 = arith.constant 900237903234600995 : i64; - v205 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v204) : felt - v207 = arith.constant 44 : u32; + 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, v207 : u32 #[overflow = checked]; - v438 = arith.constant 4 : u32; - v210 = arith.mod v208, v438 : 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, v205; - v437 = arith.constant 40 : u32; + hir.store v211, v197; + v213 = arith.constant 116 : u32; v212 = hir.bitcast v103 : u32; - v214 = arith.add v212, v437 : u32 #[overflow = checked]; - v436 = arith.constant 4 : u32; - v216 = arith.mod v214, v436 : 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, v203; - v219 = arith.constant 36 : u32; + hir.store v217, v195; + v468 = arith.constant 112 : u32; v218 = hir.bitcast v103 : u32; - v220 = arith.add v218, v219 : u32 #[overflow = checked]; - v435 = arith.constant 4 : u32; - v222 = arith.mod v220, v435 : 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, v201; - v434 = arith.constant 32 : u32; - v224 = hir.bitcast v103 : u32; - v226 = arith.add v224, v434 : u32 #[overflow = checked]; - v433 = arith.constant 4 : u32; - v228 = arith.mod v226, v433 : u32; - hir.assertz v228 #[code = 250]; - v229 = hir.int_to_ptr v226 : ptr; - hir.store v229, v199; - v432 = arith.constant 80 : i32; - v231 = arith.add v103, v432 : i32 #[overflow = wrapping]; - v232 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v103, v231) : i32 - v431 = arith.constant 0 : i32; + 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.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; - v234 = arith.eq v232, v96 : i1; - v235 = arith.zext v234 : u32; - v236 = hir.bitcast v235 : i32; - v238 = arith.neq v236, v431 : i1; - v421 = scf.if v238 : u32 { + 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: - v417 = arith.constant 0 : u32; - scf.yield v417; + v445 = arith.constant 0 : u32; + scf.yield v445; } else { ^block13: - v430 = arith.constant 32 : i32; - v240 = arith.add v103, v430 : i32 #[overflow = wrapping]; - v241 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v163, v240) : i32 - v428 = arith.constant 0 : i32; - v429 = arith.constant 0 : i32; - v243 = arith.eq v241, v429 : i1; - v244 = arith.zext v243 : u32; - v245 = hir.bitcast v244 : i32; - v247 = arith.neq v245, v428 : i1; - scf.if v247{ + 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: scf.yield ; } else { ^block14: - v248 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr - v249 = hir.bitcast v248 : ptr; - hir.store v249, v99; + 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; scf.yield ; }; - v419 = arith.constant 1 : u32; - v427 = arith.constant 0 : u32; - v425 = cf.select v247, v427, v419 : u32; - scf.yield v425; + v447 = arith.constant 1 : u32; + v455 = arith.constant 0 : u32; + v453 = cf.select v275, v455, v447 : u32; + scf.yield v453; }; - v426 = arith.constant 0 : u32; - v424 = arith.eq v421, v426 : i1; - cf.cond_br v424 ^block12, ^block38; + v454 = arith.constant 0 : u32; + v452 = arith.eq v449, v454 : i1; + cf.cond_br v452 ^block12, ^block38; ^block12: ub.unreachable ; ^block38: builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v250: i32, v251: i32) { - ^block15(v250: i32, v251: i32): - v254 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr - v255 = hir.bitcast v254 : ptr; - v256 = hir.load v255 : i32; - v257 = arith.constant 16 : i32; - v258 = arith.sub v256, v257 : i32 #[overflow = wrapping]; - v260 = arith.constant 8 : u32; - v259 = hir.bitcast v251 : u32; - v261 = arith.add v259, v260 : u32 #[overflow = checked]; - v540 = arith.constant 8 : u32; - v263 = arith.mod v261, v540 : u32; - hir.assertz v263 #[code = 250]; - v264 = hir.int_to_ptr v261 : ptr; - v265 = hir.load v264 : i64; - v539 = arith.constant 8 : u32; - v266 = hir.bitcast v258 : u32; - v268 = arith.add v266, v539 : u32 #[overflow = checked]; - v269 = arith.constant 4 : u32; - v270 = arith.mod v268, v269 : u32; - hir.assertz v270 #[code = 250]; - v271 = hir.int_to_ptr v268 : ptr; - hir.store v271, v265; - v272 = hir.bitcast v251 : u32; - v538 = arith.constant 8 : u32; - v274 = arith.mod v272, v538 : u32; - hir.assertz v274 #[code = 250]; - v275 = hir.int_to_ptr v272 : ptr; - v276 = hir.load v275 : i64; - v277 = hir.bitcast v258 : u32; - v537 = arith.constant 4 : u32; - v279 = arith.mod v277, v537 : u32; - hir.assertz v279 #[code = 250]; - v280 = hir.int_to_ptr v277 : ptr; - hir.store v280, v276; - v281 = arith.constant 12 : i32; - v282 = arith.add v258, v281 : i32 #[overflow = wrapping]; - v252 = arith.constant 0 : i32; - v508, v509, v510, v511, v512, v513 = scf.while v252, v258, v282, v250 : i32, i32, i32, i32, i32, i32 { - ^block48(v514: i32, v515: i32, v516: i32, v517: i32): - v536 = arith.constant 0 : i32; - v285 = arith.constant 8 : i32; - v286 = arith.eq v514, v285 : i1; - v287 = arith.zext v286 : u32; - v288 = hir.bitcast v287 : i32; - v290 = arith.neq v288, v536 : i1; - v502, v503 = scf.if v290 : i32, i32 { + 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: - v462 = ub.poison i32 : i32; - scf.yield v462, v462; + v494 = ub.poison i32 : i32; + scf.yield v494, v494; } else { ^block20: - v292 = arith.add v515, v514 : i32 #[overflow = wrapping]; - v293 = hir.bitcast v292 : u32; - v535 = arith.constant 4 : u32; - v295 = arith.mod v293, v535 : u32; - hir.assertz v295 #[code = 250]; - v296 = hir.int_to_ptr v293 : ptr; - v297 = hir.load v296 : felt; - v299 = hir.bitcast v516 : u32; - v534 = arith.constant 4 : u32; - v301 = arith.mod v299, v534 : u32; - hir.assertz v301 #[code = 250]; - v302 = hir.int_to_ptr v299 : ptr; - v303 = hir.load v302 : i32; - v304 = hir.bitcast v292 : u32; - v533 = arith.constant 4 : u32; - v306 = arith.mod v304, v533 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - hir.store v307, v303; - v308 = hir.bitcast v516 : u32; - v532 = arith.constant 4 : u32; - v310 = arith.mod v308, v532 : u32; - hir.assertz v310 #[code = 250]; - v311 = hir.int_to_ptr v308 : ptr; - hir.store v311, v297; - v314 = arith.constant -4 : i32; - v315 = arith.add v516, v314 : i32 #[overflow = wrapping]; - v312 = arith.constant 4 : i32; - v313 = arith.add v514, v312 : i32 #[overflow = wrapping]; - scf.yield v313, v315; + 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; }; - v530 = ub.poison i32 : i32; - v505 = cf.select v290, v530, v517 : i32; - v531 = ub.poison i32 : i32; - v504 = cf.select v290, v531, v515 : i32; - v461 = arith.constant 1 : u32; - v454 = arith.constant 0 : u32; - v507 = cf.select v290, v454, v461 : u32; - v495 = arith.trunc v507 : i1; - scf.condition v495, v502, v504, v503, v505, v515, v517; + 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(v518: i32, v519: i32, v520: i32, v521: i32, v522: i32, v523: i32): - scf.yield v518, v519, v520, v521; + ^block49(v550: i32, v551: i32, v552: i32, v553: i32, v554: i32, v555: i32): + scf.yield v550, v551, v552, v553; }; - v529 = arith.constant 8 : u32; - v317 = hir.bitcast v512 : u32; - v319 = arith.add v317, v529 : u32 #[overflow = checked]; - v528 = arith.constant 4 : u32; - v321 = arith.mod v319, v528 : u32; - hir.assertz v321 #[code = 250]; - v322 = hir.int_to_ptr v319 : ptr; - v323 = hir.load v322 : i64; - v527 = arith.constant 8 : u32; - v324 = hir.bitcast v513 : u32; - v326 = arith.add v324, v527 : u32 #[overflow = checked]; - v526 = arith.constant 8 : u32; - v328 = arith.mod v326, v526 : u32; - hir.assertz v328 #[code = 250]; - v329 = hir.int_to_ptr v326 : ptr; - hir.store v329, v323; - v330 = hir.bitcast v512 : u32; - v525 = arith.constant 4 : u32; - v332 = arith.mod v330, v525 : u32; - hir.assertz v332 #[code = 250]; - v333 = hir.int_to_ptr v330 : ptr; - v334 = hir.load v333 : i64; - v335 = hir.bitcast v513 : u32; - v524 = arith.constant 8 : u32; - v337 = arith.mod v335, v524 : u32; - hir.assertz v337 #[code = 250]; - v338 = hir.int_to_ptr v335 : ptr; - hir.store v338, v334; + 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; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v339: i64) -> felt { - ^block21(v339: i64): - v340 = hir.cast v339 : felt; - builtin.ret v340; + 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::eq(v342: felt, v343: felt) -> i32 { - ^block23(v342: felt, v343: felt): - v344 = arith.eq v342, v343 : i1; - v345 = hir.cast v344 : i32; - builtin.ret v345; + 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(v347: felt, v348: felt, v349: felt, v350: felt, v351: felt, v352: felt, v353: felt, v354: felt, v355: felt, v356: felt, v357: felt, v358: felt, v359: i32) { - ^block25(v347: felt, v348: felt, v349: felt, v350: felt, v351: felt, v352: felt, v353: felt, v354: felt, v355: felt, v356: felt, v357: felt, v358: felt, v359: i32): - v360, v361, v362, v363, v364, v365, v366, v367 = hir.exec @std/collections/smt/set(v347, v348, v349, v350, v351, v352, v353, v354, v355, v356, v357, v358) : felt, felt, felt, felt, felt, felt, felt, felt - v368 = hir.bitcast v359 : u32; - v369 = hir.int_to_ptr v368 : ptr; - hir.store v369, v360; - v370 = arith.constant 4 : u32; - v371 = arith.add v368, v370 : u32 #[overflow = checked]; - v372 = hir.int_to_ptr v371 : ptr; - hir.store v372, v361; - v373 = arith.constant 8 : u32; - v374 = arith.add v368, v373 : u32 #[overflow = checked]; - v375 = hir.int_to_ptr v374 : ptr; - hir.store v375, v362; - v376 = arith.constant 12 : u32; - v377 = arith.add v368, v376 : u32 #[overflow = checked]; - v378 = hir.int_to_ptr v377 : ptr; - hir.store v378, v363; - v379 = arith.constant 16 : u32; - v380 = arith.add v368, v379 : u32 #[overflow = checked]; - v381 = hir.int_to_ptr v380 : ptr; - hir.store v381, v364; - v382 = arith.constant 20 : u32; - v383 = arith.add v368, v382 : u32 #[overflow = checked]; - v384 = hir.int_to_ptr v383 : ptr; - hir.store v384, v365; - v385 = arith.constant 24 : u32; - v386 = arith.add v368, v385 : u32 #[overflow = checked]; - v387 = hir.int_to_ptr v386 : ptr; - hir.store v387, v366; - v388 = arith.constant 28 : u32; - v389 = arith.add v368, v388 : u32 #[overflow = checked]; - v390 = hir.int_to_ptr v389 : ptr; - hir.store v390, v367; + 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; 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 40002ae17..3e8542d8a 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm @@ -232,7 +232,7 @@ pub proc entrypoint( trace.252 nop push.4294967264 - push.96 + push.128 dup.2 swap.1 u32wrapping_sub @@ -285,7 +285,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.72 + push.88 dup.3 add u32assert @@ -322,7 +322,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.64 + push.80 dup.3 add u32assert @@ -359,7 +359,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.88 + push.104 dup.3 add u32assert @@ -396,7 +396,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.80 + push.96 dup.3 add u32assert @@ -415,25 +415,97 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.64 + push.80 dup.1 u32wrapping_add dup.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::miden_stdlib_sys::intrinsics::word::Word::reverse + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::reverse trace.252 nop - push.16 + push.96 dup.1 u32wrapping_add - push.80 + push.112 dup.2 u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::reverse + trace.252 + nop + push.120 + 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 + u32wrapping_add + push.8 dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::miden_stdlib_sys::intrinsics::word::Word::reverse + 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 + 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 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw trace.252 nop push.0 @@ -464,8 +536,8 @@ pub proc entrypoint( exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked trace.252 nop - push.92 - dup.6 + push.124 + dup.5 add u32assert push.4 @@ -481,8 +553,8 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.88 - dup.5 + push.120 + dup.4 add u32assert push.4 @@ -498,8 +570,8 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.84 - dup.4 + push.116 + dup.3 add u32assert push.4 @@ -515,8 +587,8 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.80 - dup.3 + push.112 + dup.2 add u32assert push.4 @@ -561,7 +633,7 @@ pub proc entrypoint( trace.252 nop push.44 - dup.6 + dup.5 add u32assert push.4 @@ -578,7 +650,7 @@ pub proc entrypoint( trace.252 nop push.40 - dup.5 + dup.4 add u32assert push.4 @@ -595,7 +667,7 @@ pub proc entrypoint( trace.252 nop push.36 - dup.4 + dup.3 add u32assert push.4 @@ -612,7 +684,7 @@ pub proc entrypoint( trace.252 nop push.32 - dup.3 + dup.2 add u32assert push.4 @@ -628,10 +700,10 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.80 - dup.2 + push.112 + dup.1 u32wrapping_add - dup.2 + dup.1 trace.240 nop exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::eq @@ -643,15 +715,16 @@ pub proc entrypoint( eq neq if.true - drop drop drop push.0 else push.32 + dup.1 + u32wrapping_add + push.16 movup.2 u32wrapping_add - swap.1 trace.240 nop exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::eq @@ -694,7 +767,7 @@ pub proc entrypoint( end @callconv("C") -proc miden_stdlib_sys::intrinsics::word::Word::reverse( +proc ::reverse( i32, i32 ) @@ -970,6 +1043,11 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( 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 @@ -986,11 +1064,6 @@ proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt add end -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - @callconv("C") proc std::collections::smt::set( felt, diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.wat b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat index 3eaa28769..ef2dfdf4e 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.wat +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat @@ -2,8 +2,8 @@ (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 i64) (result f32))) - (type (;4;) (func (param f32 f32) (result 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))) (table (;0;) 1 1 funcref) (memory (;0;) 16) @@ -51,12 +51,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 i32) + (local i32 i32) global.get $__stack_pointer local.tee 12 local.set 13 local.get 12 - i32.const 96 + i32.const 128 i32.sub i32.const -32 i32.and @@ -81,32 +81,41 @@ local.get 12 local.get 12 i64.load offset=40 - i64.store offset=72 + i64.store offset=88 local.get 12 local.get 12 i64.load offset=32 - i64.store offset=64 + i64.store offset=80 local.get 12 local.get 12 i64.load offset=56 - i64.store offset=88 + i64.store offset=104 local.get 12 local.get 12 i64.load offset=48 - i64.store offset=80 + i64.store offset=96 local.get 12 local.get 12 - i32.const 64 + i32.const 80 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse local.get 12 - i32.const 16 + i32.const 112 i32.add - local.tee 14 local.get 12 - i32.const 80 + i32.const 96 i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + call $::reverse + local.get 12 + i32.const 24 + i32.add + local.get 12 + i64.load offset=120 + i64.store + local.get 12 + local.get 12 + i64.load offset=112 + i64.store offset=16 i64.const 0 call $intrinsics::felt::from_u64_unchecked local.set 8 @@ -119,16 +128,16 @@ local.get 12 i64.const 0 call $intrinsics::felt::from_u64_unchecked - f32.store offset=92 + f32.store offset=124 local.get 12 local.get 10 - f32.store offset=88 + f32.store offset=120 local.get 12 local.get 9 - f32.store offset=84 + f32.store offset=116 local.get 12 local.get 8 - f32.store offset=80 + f32.store offset=112 i64.const -8162549007765693629 call $intrinsics::felt::from_u64_unchecked local.set 8 @@ -154,12 +163,14 @@ block ;; label = @1 local.get 12 local.get 12 - i32.const 80 + i32.const 112 i32.add call $::eq i32.eqz br_if 0 (;@1;) - local.get 14 + local.get 12 + i32.const 16 + i32.add local.get 12 i32.const 32 i32.add @@ -172,7 +183,7 @@ end unreachable ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;2;) (type 2) (param i32 i32) + (func $::reverse (;2;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -230,10 +241,10 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) + (func $intrinsics::felt::eq (;3;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::eq (;4;) (type 4) (param f32 f32) (result i32) + (func $intrinsics::felt::from_u64_unchecked (;4;) (type 4) (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) diff --git a/tests/integration/expected/types/array.hir b/tests/integration/expected/types/array.hir index 0cff3eeaa..05eeab077 100644 --- a/tests/integration/expected/types/array.hir +++ b/tests/integration/expected/types/array.hir @@ -1,65 +1,65 @@ builtin.component root_ns:root@1.0.0 { - builtin.module public @test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6 { - public builtin.function @sum_arr(v0: i32, v1: i32) -> i32 { - ^block6(v0: i32, v1: i32): - v93 = arith.constant 0 : i32; - v3 = arith.constant 0 : i32; - v6 = arith.eq v1, v3 : i1; - v7 = arith.zext v6 : u32; - v8 = hir.bitcast v7 : i32; - v10 = arith.neq v8, v93 : i1; - v66 = scf.if v10 : i32 { - ^block8: - v92 = arith.constant 0 : i32; - scf.yield v92; + 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 + 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; + 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; } else { - ^block9: - v91 = arith.constant 0 : i32; - v77, v78, v79, v80 = scf.while v0, v91, v1 : i32, i32, i32, i32 { - ^block23(v81: i32, v82: i32, v83: i32): - v12 = hir.bitcast v81 : u32; - v13 = arith.constant 4 : u32; - v14 = arith.mod v12, v13 : u32; - hir.assertz v14 #[code = 250]; - v15 = hir.int_to_ptr v12 : ptr; - v16 = hir.load v15 : i32; - v18 = arith.add v16, v82 : i32 #[overflow = wrapping]; - v22 = arith.constant -1 : i32; - v23 = arith.add v83, v22 : i32 #[overflow = wrapping]; - v90 = arith.constant 0 : i32; - v25 = arith.neq v23, v90 : i1; - v88 = ub.poison i32 : i32; - v74 = cf.select v25, v23, v88 : i32; + ^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; + 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; - v73 = cf.select v25, v18, v89 : i32; - v43 = ub.poison i32 : i32; - v19 = arith.constant 4 : i32; - v20 = arith.add v81, v19 : i32 #[overflow = wrapping]; - v72 = cf.select v25, v20, v43 : i32; - v36 = arith.constant 0 : u32; - v42 = arith.constant 1 : u32; - v76 = cf.select v25, v42, v36 : u32; - v65 = arith.trunc v76 : i1; - scf.condition v65, v72, v73, v74, v18; + 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; } do { - ^block24(v84: i32, v85: i32, v86: i32, v87: i32): - scf.yield v84, v85, v86; + ^block24(v85: i32, v86: i32, v87: i32, v88: i32): + scf.yield v85, v86, v87; }; - scf.yield v80; + scf.yield v81; }; - builtin.ret v66; - }; - - public builtin.function @__main() -> i32 { - ^block13: - v29 = arith.constant 5 : i32; - v28 = arith.constant 1048576 : i32; - v30 = hir.exec @root_ns:root@1.0.0/test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6/sum_arr(v28, v29) : i32 - v94 = arith.constant 5 : i32; - v31 = arith.constant 1048596 : i32; - v33 = hir.exec @root_ns:root@1.0.0/test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6/sum_arr(v31, v94) : i32 - v34 = arith.add v30, v33 : i32 #[overflow = wrapping]; - builtin.ret v34; + builtin.ret v67; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/types/array.masm b/tests/integration/expected/types/array.masm index c3dbb487b..18c28ac3c 100644 --- a/tests/integration/expected/types/array.masm +++ b/tests/integration/expected/types/array.masm @@ -24,7 +24,28 @@ proc init mem_store.278546 end -# mod root_ns:root@1.0.0::test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6 +# mod root_ns:root@1.0.0::test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d + +@callconv("C") +pub proc __main( + +) -> i32 + push.5 + push.1048576 + trace.240 + nop + 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 + trace.252 + nop + u32wrapping_add +end @callconv("C") pub proc sum_arr(i32, i32) -> i32 @@ -102,24 +123,3 @@ pub proc sum_arr(i32, i32) -> i32 end end -@callconv("C") -pub proc __main( - -) -> i32 - push.5 - push.1048576 - trace.240 - nop - exec.::root_ns:root@1.0.0::test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6::sum_arr - trace.252 - nop - push.5 - push.1048596 - trace.240 - nop - exec.::root_ns:root@1.0.0::test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6::sum_arr - trace.252 - nop - u32wrapping_add -end - diff --git a/tests/integration/expected/types/array.wat b/tests/integration/expected/types/array.wat index 04fe03ebf..0db4456f8 100644 --- a/tests/integration/expected/types/array.wat +++ b/tests/integration/expected/types/array.wat @@ -1,16 +1,25 @@ -(module $test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6.wasm - (type (;0;) (func (param i32 i32) (result i32))) - (type (;1;) (func (result i32))) +(module $test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d.wasm + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32 i32) (result i32))) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (global (;1;) i32 i32.const 1048616) (global (;2;) i32 i32.const 1048624) (export "memory" (memory 0)) - (export "sum_arr" (func $sum_arr)) (export "__main" (func $__main)) + (export "sum_arr" (func $sum_arr)) (export "__data_end" (global 1)) (export "__heap_base" (global 2)) - (func $sum_arr (;0;) (type 0) (param i32 i32) (result i32) + (func $__main (;0;) (type 0) (result i32) + i32.const 1048576 + i32.const 5 + call $sum_arr + i32.const 1048596 + i32.const 5 + call $sum_arr + i32.add + ) + (func $sum_arr (;1;) (type 1) (param i32 i32) (result i32) (local i32) i32.const 0 local.set 2 @@ -37,14 +46,5 @@ end local.get 2 ) - (func $__main (;1;) (type 1) (result i32) - i32.const 1048576 - i32.const 5 - call $sum_arr - i32.const 1048596 - i32.const 5 - call $sum_arr - i32.add - ) (data $.rodata (;0;) (i32.const 1048576) "\01\00\00\00\02\00\00\00\03\00\00\00\04\00\00\00\05\00\00\00\06\00\00\00\07\00\00\00\08\00\00\00\09\00\00\00\0a\00\00\00") ) diff --git a/tests/integration/expected/types/enum.hir b/tests/integration/expected/types/enum.hir index 3b4a6b6e2..9a5da3fae 100644 --- a/tests/integration/expected/types/enum.hir +++ b/tests/integration/expected/types/enum.hir @@ -1,46 +1,46 @@ builtin.component root_ns:root@1.0.0 { - builtin.module public @test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824 { - public builtin.function @match_enum(v0: i32, v1: i32, v2: i32) -> i32 { - ^block6(v0: i32, v1: i32, v2: i32): - v4 = arith.constant 255 : i32; - v5 = arith.band v2, v4 : i32; - v6 = hir.cast v5 : u32; - v27 = scf.index_switch v6 : i32 + 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 + v9 = arith.add v4, v8 : i32 #[overflow = wrapping]; + v14 = arith.add v9, v13 : i32 #[overflow = wrapping]; + builtin.ret v14; + }; + + 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 case 1 { - ^block9: - v8 = arith.sub v0, v1 : i32 #[overflow = wrapping]; - scf.yield v8; + ^block11: + v23 = arith.sub v15, v16 : i32 #[overflow = wrapping]; + scf.yield v23; } case 2 { - ^block8: - v9 = arith.mul v1, v0 : i32 #[overflow = wrapping]; - scf.yield v9; + ^block10: + v24 = arith.mul v16, v15 : i32 #[overflow = wrapping]; + scf.yield v24; } default { - ^block10: - v7 = arith.add v1, v0 : i32 #[overflow = wrapping]; - scf.yield v7; + ^block12: + v22 = arith.add v16, v15 : i32 #[overflow = wrapping]; + scf.yield v22; }; - builtin.ret v27; - }; - - public builtin.function @__main() -> i32 { - ^block11: - v13 = arith.constant 0 : i32; - v12 = arith.constant 5 : i32; - v11 = arith.constant 3 : i32; - v14 = hir.exec @root_ns:root@1.0.0/test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824/match_enum(v11, v12, v13) : i32 - v17 = arith.constant 1 : i32; - v30 = arith.constant 5 : i32; - v31 = arith.constant 3 : i32; - v18 = hir.exec @root_ns:root@1.0.0/test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824/match_enum(v31, v30, v17) : i32 - v22 = arith.constant 2 : i32; - v28 = arith.constant 5 : i32; - v29 = arith.constant 3 : i32; - v23 = hir.exec @root_ns:root@1.0.0/test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824/match_enum(v29, v28, v22) : i32 - v19 = arith.add v14, v18 : i32 #[overflow = wrapping]; - v24 = arith.add v19, v23 : i32 #[overflow = wrapping]; - builtin.ret v24; + builtin.ret v31; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/types/enum.masm b/tests/integration/expected/types/enum.masm index b65d578e7..819b5472d 100644 --- a/tests/integration/expected/types/enum.masm +++ b/tests/integration/expected/types/enum.masm @@ -16,37 +16,7 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824 - -@callconv("C") -pub proc match_enum(i32, i32, i32) -> i32 - push.255 - movup.3 - u32and - dup.0 - push.2147483648 - u32lte - assert - dup.0 - push.2 - u32lte - if.true - eq.1 - if.true - swap.1 - u32wrapping_sub - else - trace.240 - nop - exec.::intrinsics::i32::wrapping_mul - trace.252 - nop - end - else - drop - u32wrapping_add - end -end +# mod root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c @callconv("C") pub proc __main( @@ -57,7 +27,7 @@ pub proc __main( push.3 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824::match_enum + exec.::root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum trace.252 nop push.1 @@ -65,7 +35,7 @@ pub proc __main( push.3 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824::match_enum + exec.::root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum trace.252 nop push.2 @@ -73,7 +43,7 @@ pub proc __main( push.3 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824::match_enum + exec.::root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum trace.252 nop movdn.2 @@ -81,3 +51,33 @@ pub proc __main( u32wrapping_add end +@callconv("C") +pub proc match_enum(i32, i32, i32) -> i32 + push.255 + movup.3 + u32and + dup.0 + push.2147483648 + u32lte + assert + dup.0 + push.2 + u32lte + if.true + eq.1 + if.true + swap.1 + u32wrapping_sub + else + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + end + else + drop + u32wrapping_add + end +end + diff --git a/tests/integration/expected/types/enum.wat b/tests/integration/expected/types/enum.wat index f7eeed058..7e43b0b94 100644 --- a/tests/integration/expected/types/enum.wat +++ b/tests/integration/expected/types/enum.wat @@ -1,16 +1,32 @@ -(module $test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824.wasm - (type (;0;) (func (param i32 i32 i32) (result i32))) - (type (;1;) (func (result i32))) +(module $test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c.wasm + (type (;0;) (func (result i32))) + (type (;1;) (func (param i32 i32 i32) (result i32))) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (global (;1;) i32 i32.const 1048576) (global (;2;) i32 i32.const 1048576) (export "memory" (memory 0)) - (export "match_enum" (func $match_enum)) (export "__main" (func $__main)) + (export "match_enum" (func $match_enum)) (export "__data_end" (global 1)) (export "__heap_base" (global 2)) - (func $match_enum (;0;) (type 0) (param i32 i32 i32) (result i32) + (func $__main (;0;) (type 0) (result i32) + i32.const 3 + i32.const 5 + i32.const 0 + call $match_enum + i32.const 3 + i32.const 5 + i32.const 1 + call $match_enum + i32.add + i32.const 3 + i32.const 5 + i32.const 2 + call $match_enum + i32.add + ) + (func $match_enum (;1;) (type 1) (param i32 i32 i32) (result i32) block ;; label = @1 block ;; label = @2 block ;; label = @3 @@ -33,20 +49,4 @@ local.get 0 i32.mul ) - (func $__main (;1;) (type 1) (result i32) - i32.const 3 - i32.const 5 - i32.const 0 - call $match_enum - i32.const 3 - i32.const 5 - i32.const 1 - call $match_enum - i32.add - i32.const 3 - i32.const 5 - i32.const 2 - call $match_enum - i32.add - ) ) diff --git a/tests/integration/expected/types/static_mut.hir b/tests/integration/expected/types/static_mut.hir index 28650d2dd..082148801 100644 --- a/tests/integration/expected/types/static_mut.hir +++ b/tests/integration/expected/types/static_mut.hir @@ -1,61 +1,61 @@ builtin.component root_ns:root@1.0.0 { - builtin.module public @test_rust_e6d553fb1c80aef6e5d6f2891701197bedac471cf510bd2495f99889d9543cd4 { - public builtin.function @global_var_update() { - ^block6: - v3 = arith.constant 1048577 : u32; - v38 = arith.constant 0 : u32; - v4 = arith.add v38, v3 : u32 #[overflow = checked]; - v5 = hir.int_to_ptr v4 : ptr; - v6 = hir.load v5 : u8; - v9 = arith.constant 1 : i32; - v7 = arith.zext v6 : u32; - v8 = hir.bitcast v7 : i32; - v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; - v11 = hir.bitcast v10 : u32; - v12 = arith.trunc v11 : u8; - v14 = arith.constant 1048576 : u32; - v39 = arith.constant 0 : u32; - v15 = arith.add v39, v14 : u32 #[overflow = checked]; - v16 = hir.int_to_ptr v15 : ptr; - hir.store v16, v12; - builtin.ret ; - }; - + builtin.module public @test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778 { public builtin.function @__main() -> i32 { - ^block8: - hir.exec @root_ns:root@1.0.0/test_rust_e6d553fb1c80aef6e5d6f2891701197bedac471cf510bd2495f99889d9543cd4/global_var_update() - v18 = arith.constant 0 : i32; - v20 = arith.constant -9 : i32; - v73, v74, v75 = scf.while v20, v18 : i32, i32, i32 { - ^block21(v76: i32, v77: i32): - v22 = arith.constant 1048585 : i32; - v23 = arith.add v76, v22 : i32 #[overflow = wrapping]; - v24 = hir.bitcast v23 : u32; - v25 = hir.int_to_ptr v24 : ptr; - v26 = hir.load v25 : u8; - v27 = arith.zext v26 : u32; - v28 = hir.bitcast v27 : i32; - v30 = arith.add v28, v77 : i32 #[overflow = wrapping]; - v31 = arith.constant 1 : i32; - v32 = arith.add v76, v31 : i32 #[overflow = wrapping]; - v82 = arith.constant 0 : i32; - v34 = arith.neq v32, v82 : i1; - v81 = ub.poison i32 : i32; - v70 = cf.select v34, v30, v81 : i32; - v47 = ub.poison i32 : i32; - v69 = cf.select v34, v32, v47 : i32; - v41 = arith.constant 0 : u32; - v46 = arith.constant 1 : u32; - v72 = cf.select v34, v46, v41 : u32; - v64 = arith.trunc v72 : i1; - scf.condition v64, v69, v70, v30; + ^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; } do { - ^block22(v78: i32, v79: i32, v80: i32): - scf.yield v78, v79; + ^block22(v75: i32, v76: i32, v77: i32): + scf.yield v75, v76; }; - v35 = arith.constant 255 : i32; - v36 = arith.band v75, v35 : i32; - builtin.ret v36; + v18 = arith.constant 255 : i32; + v19 = arith.band v72, v18 : i32; + builtin.ret v19; + }; + + 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; + builtin.ret ; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/types/static_mut.masm b/tests/integration/expected/types/static_mut.masm index c25ebd893..039d52033 100644 --- a/tests/integration/expected/types/static_mut.masm +++ b/tests/integration/expected/types/static_mut.masm @@ -24,60 +24,7 @@ proc init mem_store.278538 end -# mod root_ns:root@1.0.0::test_rust_e6d553fb1c80aef6e5d6f2891701197bedac471cf510bd2495f99889d9543cd4 - -@callconv("C") -pub proc global_var_update( - -) - push.1048577 - push.0 - add - u32assert - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - push.1 - swap.1 - u32wrapping_add - push.255 - u32and - push.1048576 - push.0 - add - u32assert - 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 +# mod root_ns:root@1.0.0::test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778 @callconv("C") pub proc __main( @@ -85,7 +32,7 @@ pub proc __main( ) -> i32 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_e6d553fb1c80aef6e5d6f2891701197bedac471cf510bd2495f99889d9543cd4::global_var_update + exec.::root_ns:root@1.0.0::test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778::global_var_update trace.252 nop push.0 @@ -148,3 +95,56 @@ pub proc __main( u32and end +@callconv("C") +pub proc global_var_update( + +) + push.1048577 + push.0 + add + u32assert + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.1 + swap.1 + u32wrapping_add + push.255 + u32and + push.1048576 + push.0 + add + u32assert + 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 + diff --git a/tests/integration/expected/types/static_mut.wat b/tests/integration/expected/types/static_mut.wat index 04aa08a0d..4fd73de34 100644 --- a/tests/integration/expected/types/static_mut.wat +++ b/tests/integration/expected/types/static_mut.wat @@ -1,24 +1,16 @@ -(module $test_rust_e6d553fb1c80aef6e5d6f2891701197bedac471cf510bd2495f99889d9543cd4.wasm - (type (;0;) (func)) - (type (;1;) (func (result i32))) +(module $test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778.wasm + (type (;0;) (func (result i32))) + (type (;1;) (func)) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (global (;1;) i32 i32.const 1048585) (global (;2;) i32 i32.const 1048592) (export "memory" (memory 0)) - (export "global_var_update" (func $global_var_update)) (export "__main" (func $__main)) + (export "global_var_update" (func $global_var_update)) (export "__data_end" (global 1)) (export "__heap_base" (global 2)) - (func $global_var_update (;0;) (type 0) - i32.const 0 - i32.const 0 - i32.load8_u offset=1048577 - i32.const 1 - i32.add - i32.store8 offset=1048576 - ) - (func $__main (;1;) (type 1) (result i32) + (func $__main (;0;) (type 0) (result i32) (local i32 i32 i32) call $global_var_update i32.const 0 @@ -45,5 +37,13 @@ i32.const 255 i32.and ) + (func $global_var_update (;1;) (type 1) + i32.const 0 + i32.const 0 + i32.load8_u offset=1048577 + i32.const 1 + i32.add + i32.store8 offset=1048576 + ) (data $.data (;0;) (i32.const 1048576) "\01\02\03\04\05\06\07\08\09") ) diff --git a/tests/integration/expected/vec_alloc_vec.hir b/tests/integration/expected/vec_alloc_vec.hir index 10c30ffd4..682461400 100644 --- a/tests/integration/expected/vec_alloc_vec.hir +++ b/tests/integration/expected/vec_alloc_vec.hir @@ -1,27 +1,39 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @vec_alloc_vec { - public builtin.function @entrypoint(v0: i32) -> felt { - ^block4(v0: i32): - v4 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v5 = hir.bitcast v4 : ptr; - v6 = hir.load v5 : i32; - v7 = arith.constant 16 : i32; - v8 = arith.sub v6, v7 : i32 #[overflow = wrapping]; - v9 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v10 = hir.bitcast v9 : ptr; - hir.store v10, v8; + 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; + }; + + private builtin.function @__rustc::__rust_dealloc(v5: i32, v6: i32, v7: i32) { + ^block6(v5: i32, v6: i32, v7: i32): + builtin.ret ; + }; + + public builtin.function @entrypoint(v8: i32) -> felt { + ^block8(v8: i32): + 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]; + 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() - v12 = arith.constant 4 : i32; - v11 = arith.constant 12 : i32; - v13 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_alloc(v11, v12) : i32 + 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; - v2 = arith.constant 0 : i32; - v15 = arith.eq v13, v2 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v338 : i1; - v310, v311 = scf.if v19 : felt, u32 { - ^block7: + v10 = arith.constant 0 : i32; + v23 = arith.eq v21, v10 : i1; + v24 = arith.zext v23 : u32; + v25 = hir.bitcast v24 : i32; + v27 = arith.neq v25, v338 : i1; + v310, v311 = 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) @@ -29,120 +41,108 @@ builtin.component root_ns:root@1.0.0 { v306 = ub.poison felt : felt; scf.yield v306, v302; } else { - ^block8: - v20 = arith.constant 1 : i32; - v21 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v20) : felt - v22 = arith.constant 2 : i32; - v23 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v22) : felt - v24 = arith.constant 3 : i32; - v25 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v24) : felt - v27 = arith.constant 8 : u32; - v26 = hir.bitcast v13 : u32; - v28 = arith.add v26, v27 : u32 #[overflow = checked]; - v29 = arith.constant 4 : u32; - v30 = arith.mod v28, v29 : u32; - hir.assertz v30 #[code = 250]; - v31 = hir.int_to_ptr v28 : ptr; - hir.store v31, v25; + ^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; - v32 = hir.bitcast v13 : u32; - v34 = arith.add v32, v335 : u32 #[overflow = checked]; + v40 = hir.bitcast v21 : u32; + v42 = arith.add v40, v335 : u32 #[overflow = checked]; v334 = arith.constant 4 : u32; - v36 = arith.mod v34, v334 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v23; - v38 = hir.bitcast v13 : 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; - v40 = arith.mod v38, v333 : u32; - hir.assertz v40 #[code = 250]; - v41 = hir.int_to_ptr v38 : ptr; - hir.store v41, v21; - v44 = arith.constant 12 : u32; - v43 = hir.bitcast v8 : u32; - v45 = arith.add v43, v44 : u32 #[overflow = checked]; + 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; - v47 = arith.mod v45, v332 : u32; - hir.assertz v47 #[code = 250]; + v55 = arith.mod v53, v332 : u32; + hir.assertz v55 #[code = 250]; v331 = arith.constant 3 : i32; - v48 = hir.int_to_ptr v45 : ptr; - hir.store v48, v331; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v331; v330 = arith.constant 8 : u32; - v49 = hir.bitcast v8 : u32; - v51 = arith.add v49, v330 : u32 #[overflow = checked]; + v57 = hir.bitcast v16 : u32; + v59 = arith.add v57, v330 : u32 #[overflow = checked]; v329 = arith.constant 4 : u32; - v53 = arith.mod v51, v329 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - hir.store v54, v13; + v61 = arith.mod v59, v329 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + hir.store v62, v21; v328 = arith.constant 4 : u32; - v56 = hir.bitcast v8 : u32; - v58 = arith.add v56, v328 : u32 #[overflow = checked]; + v64 = hir.bitcast v16 : u32; + v66 = arith.add v64, v328 : u32 #[overflow = checked]; v327 = arith.constant 4 : u32; - v60 = arith.mod v58, v327 : u32; - hir.assertz v60 #[code = 250]; + v68 = arith.mod v66, v327 : u32; + hir.assertz v68 #[code = 250]; v326 = arith.constant 3 : i32; - v61 = hir.int_to_ptr v58 : ptr; - hir.store v61, v326; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v326; v325 = arith.constant 0 : i32; v301 = arith.constant 3 : u32; - v63 = hir.bitcast v0 : u32; - v65 = arith.gte v63, v301 : i1; - v66 = arith.zext v65 : u32; - v67 = hir.bitcast v66 : i32; - v69 = arith.neq v67, v325 : i1; - v316 = scf.if v69 : felt { + 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; } else { - ^block9: + ^block13: v300 = arith.constant 2 : u32; - v72 = arith.shl v0, v300 : i32; - v73 = arith.add v13, v72 : i32 #[overflow = wrapping]; - v74 = hir.bitcast v73 : 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; - v76 = arith.mod v74, v323 : u32; - hir.assertz v76 #[code = 250]; - v77 = hir.int_to_ptr v74 : ptr; - v78 = hir.load v77 : felt; + 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; - v80 = arith.add v8, v322 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::raw_vec::RawVecInner::deallocate(v80, v321, v321) + 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; - v84 = arith.add v8, v320 : i32 #[overflow = wrapping]; - v85 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v86 = hir.bitcast v85 : ptr; - hir.store v86, v84; - scf.yield v78; + 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; }; v307 = arith.constant 1 : u32; v319 = arith.constant 0 : u32; - v317 = cf.select v69, v319, v307 : u32; + v317 = cf.select v77, v319, v307 : u32; scf.yield v316, v317; }; v318 = arith.constant 0 : u32; v315 = arith.eq v311, v318 : i1; - cf.cond_br v315 ^block6, ^block50(v310); - ^block6: + cf.cond_br v315 ^block10, ^block50(v310); + ^block10: ub.unreachable ; ^block50(v303: felt): builtin.ret v303; }; - private builtin.function @__rustc::__rust_alloc(v89: i32, v90: i32) -> i32 { - ^block10(v89: i32, v90: i32): - v92 = arith.constant 1048576 : i32; - v93 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::alloc(v92, v90, v89) : i32 - builtin.ret v93; - }; - - private builtin.function @__rustc::__rust_dealloc(v94: i32, v95: i32, v96: i32) { - ^block12(v94: i32, v95: i32, v96: i32): - builtin.ret ; - }; - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { ^block14: builtin.ret ; @@ -171,7 +171,7 @@ builtin.component root_ns:root@1.0.0 { scf.yield v345, v341; } else { ^block19: - v118 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/core::ptr::alignment::Alignment::max(v98, v111) : i32 + 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]; @@ -279,163 +279,163 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v180; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v182: i32, v183: i32, v184: i32) { - ^block31(v182: i32, v183: i32, v184: i32): - v186 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v187 = hir.bitcast v186 : ptr; - v188 = hir.load v187 : i32; - v189 = arith.constant 16 : i32; - v190 = arith.sub v188, v189 : i32 #[overflow = wrapping]; - v191 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v192 = hir.bitcast v191 : ptr; - hir.store v192, v190; - v193 = arith.constant 4 : i32; - v194 = arith.add v190, v193 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::raw_vec::RawVecInner::current_memory(v194, v182, v183, v184) - v196 = arith.constant 8 : u32; - v195 = hir.bitcast v190 : u32; - v197 = arith.add v195, v196 : 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; - v201 = hir.load v200 : i32; + private builtin.function @alloc::alloc::handle_alloc_error(v182: i32, v183: i32) { + ^block31(v182: i32, v183: 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; - v185 = arith.constant 0 : i32; - v203 = arith.eq v201, v185 : i1; - v204 = arith.zext v203 : u32; - v205 = hir.bitcast v204 : i32; - v207 = arith.neq v205, v387 : i1; - scf.if v207{ + 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: scf.yield ; } else { - ^block34: + ^block36: v386 = arith.constant 4 : u32; - v208 = hir.bitcast v190 : u32; - v210 = arith.add v208, v386 : u32 #[overflow = checked]; + v210 = hir.bitcast v192 : u32; + v212 = arith.add v210, v386 : u32 #[overflow = checked]; v385 = arith.constant 4 : u32; - v212 = arith.mod v210, v385 : u32; - hir.assertz v212 #[code = 250]; - v213 = hir.int_to_ptr v210 : ptr; - v214 = hir.load v213 : i32; - v216 = arith.constant 12 : u32; - v215 = hir.bitcast v190 : u32; - v217 = arith.add v215, v216 : u32 #[overflow = checked]; + 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; - v219 = arith.mod v217, v384 : u32; - hir.assertz v219 #[code = 250]; - v220 = hir.int_to_ptr v217 : ptr; - v221 = hir.load v220 : i32; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v214, v201, v221) + 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) scf.yield ; }; v383 = arith.constant 16 : i32; - v224 = arith.add v190, v383 : i32 #[overflow = wrapping]; - v225 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v226 = hir.bitcast v225 : ptr; - hir.store v226, v224; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v227: i32, v228: i32, v229: i32, v230: i32) { - ^block35(v227: i32, v228: i32, v229: i32, v230: i32): + 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; - v231 = arith.constant 0 : i32; - v235 = arith.eq v230, v231 : i1; - v236 = arith.zext v235 : u32; - v237 = hir.bitcast v236 : i32; - v239 = arith.neq v237, v413 : i1; - v400, v401 = scf.if v239 : i32, 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; - v233 = arith.constant 4 : i32; - scf.yield v233, v412; + v235 = arith.constant 4 : i32; + scf.yield v235, v412; } else { - ^block38: - v240 = hir.bitcast v228 : u32; - v275 = arith.constant 4 : u32; - v242 = arith.mod v240, v275 : u32; - hir.assertz v242 #[code = 250]; - v243 = hir.int_to_ptr v240 : ptr; - v244 = hir.load v243 : i32; + ^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; - v246 = arith.eq v244, v411 : i1; - v247 = arith.zext v246 : u32; - v248 = hir.bitcast v247 : i32; - v250 = arith.neq v248, v410 : i1; - v398 = scf.if v250 : 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; } else { - ^block39: + ^block41: v408 = arith.constant 4 : u32; - v251 = hir.bitcast v227 : u32; - v253 = arith.add v251, v408 : u32 #[overflow = checked]; + v253 = hir.bitcast v229 : u32; + v255 = arith.add v253, v408 : u32 #[overflow = checked]; v407 = arith.constant 4 : u32; - v255 = arith.mod v253, v407 : u32; - hir.assertz v255 #[code = 250]; - v256 = hir.int_to_ptr v253 : ptr; - hir.store v256, v229; + 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; - v257 = hir.bitcast v228 : u32; - v259 = arith.add v257, v406 : u32 #[overflow = checked]; + v259 = hir.bitcast v230 : u32; + v261 = arith.add v259, v406 : u32 #[overflow = checked]; v405 = arith.constant 4 : u32; - v261 = arith.mod v259, v405 : u32; - hir.assertz v261 #[code = 250]; - v262 = hir.int_to_ptr v259 : ptr; - v263 = hir.load v262 : i32; - v264 = hir.bitcast v227 : 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; - v266 = arith.mod v264, v404 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - hir.store v267, v263; - v268 = arith.mul v244, v230 : i32 #[overflow = wrapping]; - scf.yield v268; + 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; }; - v269 = arith.constant 8 : i32; + v271 = arith.constant 8 : i32; v403 = arith.constant 4 : i32; - v399 = cf.select v250, v403, v269 : i32; + v399 = cf.select v252, v403, v271 : i32; scf.yield v399, v398; }; - v272 = arith.add v227, v400 : i32 #[overflow = wrapping]; - v274 = hir.bitcast v272 : u32; + v274 = arith.add v229, v400 : i32 #[overflow = wrapping]; + v276 = hir.bitcast v274 : u32; v402 = arith.constant 4 : u32; - v276 = arith.mod v274, v402 : u32; - hir.assertz v276 #[code = 250]; - v277 = hir.int_to_ptr v274 : ptr; - hir.store v277, v401; + v278 = arith.mod v276, v402 : u32; + hir.assertz v278 #[code = 250]; + v279 = hir.int_to_ptr v276 : ptr; + hir.store v279, v401; builtin.ret ; }; - private builtin.function @::deallocate(v278: i32, v279: i32, v280: i32) { - ^block40(v278: i32, v279: i32, v280: i32): + private builtin.function @::deallocate(v280: i32, v281: i32, v282: i32) { + ^block42(v280: i32, v281: i32, v282: i32): v415 = arith.constant 0 : i32; - v281 = arith.constant 0 : i32; - v282 = arith.eq v280, v281 : i1; - v283 = arith.zext v282 : u32; - v284 = hir.bitcast v283 : i32; - v286 = arith.neq v284, v415 : i1; - scf.if v286{ - ^block42: + 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: scf.yield ; } else { - ^block43: - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_dealloc(v278, v280, v279) + ^block45: + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_dealloc(v280, v282, v281) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::alloc::handle_alloc_error(v287: i32, v288: i32) { - ^block44(v287: i32, v288: i32): - ub.unreachable ; - }; - - private builtin.function @core::ptr::alignment::Alignment::max(v289: i32, v290: i32) -> i32 { + private builtin.function @::max(v289: i32, v290: i32) -> i32 { ^block46(v289: i32, v290: i32): v297 = arith.constant 0 : i32; v293 = hir.bitcast v290 : u32; diff --git a/tests/integration/expected/vec_alloc_vec.masm b/tests/integration/expected/vec_alloc_vec.masm index 243b3c28f..e80d09edd 100644 --- a/tests/integration/expected/vec_alloc_vec.masm +++ b/tests/integration/expected/vec_alloc_vec.masm @@ -12,6 +12,25 @@ end # mod root_ns:root@1.0.0::vec_alloc_vec +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048576 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::vec_alloc_vec::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + @callconv("C") pub proc entrypoint(i32) -> felt push.1114112 @@ -230,7 +249,7 @@ pub proc entrypoint(i32) -> felt swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::alloc::raw_vec::RawVecInner::deallocate + exec.::root_ns:root@1.0.0::vec_alloc_vec::::deallocate trace.252 nop push.16 @@ -263,25 +282,6 @@ pub proc entrypoint(i32) -> felt end end -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048576 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop -end - @callconv("C") proc __rustc::__rust_no_alloc_shim_is_unstable_v2( @@ -320,7 +320,7 @@ proc ::alloc( movup.2 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::core::ptr::alignment::Alignment::max + exec.::root_ns:root@1.0.0::vec_alloc_vec::::max trace.252 nop push.0 @@ -486,7 +486,15 @@ proc intrinsics::felt::from_u32(i32) -> felt end @callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( +proc alloc::alloc::handle_alloc_error(i32, i32) + drop + drop + push.0 + assert +end + +@callconv("C") +proc ::deallocate( i32, i32, i32 @@ -521,7 +529,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::alloc::raw_vec::RawVecInner::current_memory + exec.::root_ns:root@1.0.0::vec_alloc_vec::::current_memory trace.252 nop push.8 @@ -603,7 +611,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end @callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( +proc ::current_memory( i32, i32, i32, @@ -761,15 +769,10 @@ proc ::deallocate( end @callconv("C") -proc alloc::alloc::handle_alloc_error(i32, i32) - drop - drop - push.0 - assert -end - -@callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 +proc ::max( + i32, + i32 +) -> i32 push.0 dup.2 dup.2 diff --git a/tests/integration/expected/vec_alloc_vec.wat b/tests/integration/expected/vec_alloc_vec.wat index 2336a527b..0eacb456c 100644 --- a/tests/integration/expected/vec_alloc_vec.wat +++ b/tests/integration/expected/vec_alloc_vec.wat @@ -1,18 +1,25 @@ (module $vec_alloc_vec.wasm - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param i32 i32) (result i32))) - (type (;2;) (func (param i32 i32 i32))) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32 i32 i32))) + (type (;2;) (func (param i32) (result f32))) (type (;3;) (func)) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) - (type (;6;) (func (param i32 i32 i32 i32))) - (type (;7;) (func (param i32 i32))) + (type (;6;) (func (param i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;0;) (type 0) (param i32) (result f32) + (func $__rustc::__rust_alloc (;0;) (type 0) (param i32 i32) (result i32) + i32.const 1048576 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_dealloc (;1;) (type 1) (param i32 i32 i32)) + (func $entrypoint (;2;) (type 2) (param i32) (result f32) (local i32 i32 f32 f32) global.get $__stack_pointer i32.const 16 @@ -69,7 +76,7 @@ i32.add i32.const 4 i32.const 4 - call $alloc::raw_vec::RawVecInner::deallocate + call $::deallocate local.get 1 i32.const 16 i32.add @@ -83,13 +90,6 @@ end unreachable ) - (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) - i32.const 1048576 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 3) return ) @@ -112,7 +112,7 @@ i32.const -2147483648 local.get 1 local.get 3 - call $core::ptr::alignment::Alignment::max + call $::max local.tee 1 i32.sub i32.gt_u @@ -168,10 +168,13 @@ (func $intrinsics::mem::heap_base (;5;) (type 5) (result i32) unreachable ) - (func $intrinsics::felt::from_u32 (;6;) (type 0) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;6;) (type 2) (param i32) (result f32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;7;) (type 2) (param i32 i32 i32) + (func $alloc::alloc::handle_alloc_error (;7;) (type 6) (param i32 i32) + unreachable + ) + (func $::deallocate (;8;) (type 1) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -184,7 +187,7 @@ local.get 0 local.get 1 local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory + call $::current_memory block ;; label = @1 local.get 3 i32.load offset=8 @@ -203,7 +206,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::current_memory (;8;) (type 6) (param i32 i32 i32 i32) + (func $::current_memory (;9;) (type 7) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -238,7 +241,7 @@ local.get 4 i32.store ) - (func $::deallocate (;9;) (type 2) (param i32 i32 i32) + (func $::deallocate (;10;) (type 1) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -249,10 +252,7 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::alloc::handle_alloc_error (;10;) (type 7) (param i32 i32) - unreachable - ) - (func $core::ptr::alignment::Alignment::max (;11;) (type 1) (param i32 i32) (result i32) + (func $::max (;11;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 From a6acfeaed79c8185c843419eacbb50c1e07b691b Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Sun, 14 Dec 2025 14:42:55 -0500 Subject: [PATCH 60/70] chore: run formatter after upgrade to 2024 edition --- benches/benches/is_prime_bench.rs | 2 +- codegen/masm/src/artifact.rs | 6 ++--- codegen/masm/src/emit/binary.rs | 14 +++++------ codegen/masm/src/emit/felt.rs | 2 +- codegen/masm/src/emit/int128.rs | 2 +- codegen/masm/src/emit/int32.rs | 10 ++++---- codegen/masm/src/emit/int64.rs | 2 +- codegen/masm/src/emit/mem.rs | 6 ++--- codegen/masm/src/emit/mod.rs | 20 ++++++++-------- codegen/masm/src/emit/primop.rs | 2 +- codegen/masm/src/emit/smallint.rs | 2 +- codegen/masm/src/emit/unary.rs | 20 ++++++++-------- codegen/masm/src/emitter.rs | 4 ++-- codegen/masm/src/intrinsics.rs | 2 +- codegen/masm/src/lib.rs | 4 ++-- codegen/masm/src/lower/component.rs | 15 ++++++------ codegen/masm/src/lower/lowering.rs | 6 ++--- codegen/masm/src/lower/utils.rs | 6 ++--- codegen/masm/src/opt/operands/context.rs | 2 +- .../masm/src/opt/operands/tactics/two_args.rs | 2 +- dialects/arith/src/builders.rs | 4 ++-- dialects/cf/src/builders.rs | 4 ++-- dialects/hir/src/attributes/pointer.rs | 2 +- dialects/hir/src/builders.rs | 4 ++-- dialects/hir/src/transforms/spill.rs | 4 ++-- dialects/hir/src/transforms/spill/tests.rs | 6 ++--- dialects/scf/src/builders.rs | 4 ++-- .../canonicalization/fold_redundant_yields.rs | 2 +- dialects/scf/src/transforms/cfg_to_scf.rs | 8 +++---- dialects/ub/src/attributes/poison.rs | 2 +- dialects/ub/src/builders.rs | 4 ++-- eval/src/eval.rs | 14 ++++------- eval/src/evaluator.rs | 6 ++--- eval/src/evaluator/context.rs | 2 +- eval/src/evaluator/frame.rs | 6 ++--- eval/src/evaluator/memory.rs | 2 +- eval/src/tests.rs | 2 +- eval/src/value.rs | 2 +- frontend/wasm/src/callable.rs | 2 +- frontend/wasm/src/code_translator/mod.rs | 6 ++--- frontend/wasm/src/code_translator/tests.rs | 4 ++-- frontend/wasm/src/component/build_ir.rs | 10 ++++---- .../wasm/src/component/canon_abi_utils.rs | 2 +- frontend/wasm/src/component/flat.rs | 2 +- frontend/wasm/src/component/lift_exports.rs | 4 ++-- frontend/wasm/src/component/lower_imports.rs | 4 ++-- frontend/wasm/src/component/parser.rs | 11 +++++---- frontend/wasm/src/component/shim_bypass.rs | 2 +- frontend/wasm/src/component/types/mod.rs | 24 +++++-------------- frontend/wasm/src/error.rs | 2 +- frontend/wasm/src/intrinsics/advice.rs | 4 ++-- frontend/wasm/src/intrinsics/crypto.rs | 4 ++-- frontend/wasm/src/intrinsics/debug.rs | 5 ++-- frontend/wasm/src/intrinsics/felt.rs | 5 ++-- frontend/wasm/src/intrinsics/intrinsic.rs | 4 ++-- frontend/wasm/src/intrinsics/mem.rs | 4 ++-- frontend/wasm/src/intrinsics/mod.rs | 2 +- frontend/wasm/src/lib.rs | 2 +- frontend/wasm/src/miden_abi/mod.rs | 2 +- .../src/miden_abi/stdlib/collections/smt.rs | 2 +- .../stdlib/crypto/dsa/rpo_falcon512.rs | 2 +- .../miden_abi/stdlib/crypto/hashes/blake3.rs | 2 +- .../src/miden_abi/stdlib/crypto/hashes/rpo.rs | 2 +- .../miden_abi/stdlib/crypto/hashes/sha256.rs | 2 +- frontend/wasm/src/miden_abi/stdlib/mem.rs | 2 +- frontend/wasm/src/miden_abi/transform.rs | 4 ++-- .../src/miden_abi/tx_kernel/active_account.rs | 2 +- .../src/miden_abi/tx_kernel/active_note.rs | 2 +- .../wasm/src/miden_abi/tx_kernel/asset.rs | 2 +- .../wasm/src/miden_abi/tx_kernel/faucet.rs | 2 +- .../src/miden_abi/tx_kernel/input_note.rs | 2 +- .../src/miden_abi/tx_kernel/native_account.rs | 2 +- .../src/miden_abi/tx_kernel/output_note.rs | 2 +- frontend/wasm/src/miden_abi/tx_kernel/tx.rs | 2 +- frontend/wasm/src/module/func_translator.rs | 4 ++-- .../wasm/src/module/function_builder_ext.rs | 4 ++-- frontend/wasm/src/module/linker_stubs.rs | 4 ++-- frontend/wasm/src/module/mod.rs | 4 ++-- frontend/wasm/src/module/module_env.rs | 20 ++++++++-------- .../src/module/module_translation_state.rs | 5 ++-- frontend/wasm/src/ssa.rs | 6 ++--- .../src/analyses/constant_propagation.rs | 6 ++--- hir-analysis/src/analyses/dce.rs | 6 ++--- hir-analysis/src/analyses/liveness.rs | 10 ++++---- hir-analysis/src/analyses/spills/tests.rs | 6 ++--- hir-analysis/src/analysis.rs | 2 +- hir-analysis/src/analysis/state/info.rs | 4 ++-- hir-analysis/src/dense.rs | 6 ++--- hir-analysis/src/dense/backward.rs | 8 +++---- hir-analysis/src/dense/forward.rs | 2 +- hir-analysis/src/solver.rs | 6 ++--- hir-analysis/src/sparse.rs | 8 +++---- hir-analysis/src/sparse/backward.rs | 4 ++-- hir-analysis/src/sparse/forward.rs | 12 +++++----- hir-macros/src/spanned.rs | 6 ++--- hir-symbol/build.rs | 2 +- hir-transform/src/canonicalization.rs | 2 +- hir-transform/src/cfg_to_scf.rs | 6 ++--- hir-transform/src/cfg_to_scf/edges.rs | 4 ++-- hir-transform/src/cfg_to_scf/transform.rs | 9 +++---- hir-transform/src/lib.rs | 4 ++-- hir-transform/src/sccp.rs | 6 ++--- hir-transform/src/sink.rs | 6 ++--- hir-transform/src/spill.rs | 8 +++---- hir/src/adt/smalldeque.rs | 4 ++-- hir/src/attributes.rs | 2 +- hir/src/derive.rs | 2 +- hir/src/dialects/builtin/builders.rs | 4 ++-- .../dialects/builtin/builders/component.rs | 2 +- hir/src/dialects/builtin/builders/module.rs | 4 ++-- hir/src/dialects/builtin/builders/world.rs | 4 ++-- hir/src/dialects/builtin/ops/cast.rs | 2 +- hir/src/dialects/builtin/ops/component.rs | 6 ++--- .../builtin/ops/component/interface.rs | 6 ++--- hir/src/dialects/builtin/ops/function.rs | 9 ++++--- .../dialects/builtin/ops/global_variable.rs | 6 ++--- hir/src/dialects/builtin/ops/interface.rs | 6 ++--- hir/src/dialects/builtin/ops/module.rs | 6 ++--- hir/src/dialects/builtin/ops/segment.rs | 4 ++-- hir/src/dialects/builtin/ops/world.rs | 4 ++-- hir/src/dialects/test/builders.rs | 2 +- hir/src/folder.rs | 6 ++--- hir/src/ir.rs | 4 ++-- hir/src/ir/cfg/diff.rs | 2 +- hir/src/ir/context.rs | 2 +- hir/src/ir/dialect.rs | 2 +- hir/src/ir/dialect/info.rs | 2 +- hir/src/ir/dominance/frontier.rs | 2 +- hir/src/ir/dominance/info.rs | 4 ++-- hir/src/ir/dominance/tree.rs | 4 ++-- hir/src/ir/effects/instance.rs | 4 ++-- hir/src/ir/entity/storage.rs | 2 +- hir/src/ir/ident.rs | 2 +- hir/src/ir/op.rs | 2 +- hir/src/ir/operation/builder.rs | 6 ++--- hir/src/ir/operation/equivalence.rs | 2 +- hir/src/ir/print.rs | 2 +- hir/src/ir/region.rs | 2 +- hir/src/ir/region/interfaces.rs | 10 +++----- hir/src/ir/region/transforms/block_merging.rs | 4 ++-- hir/src/ir/traits.rs | 2 +- hir/src/ir/traits/canonicalization.rs | 2 +- hir/src/ir/traits/types.rs | 2 +- hir/src/ir/usable.rs | 4 ++-- hir/src/ir/value/range.rs | 2 +- hir/src/ir/verifier.rs | 2 +- hir/src/lib.rs | 6 ++--- hir/src/matchers/matcher.rs | 24 ++++++++++++------- hir/src/pass/instrumentation.rs | 2 +- hir/src/pass/specialization.rs | 4 ++-- hir/src/pass/statistics.rs | 2 +- hir/src/patterns/driver.rs | 6 ++--- hir/src/patterns/pattern.rs | 4 ++-- midenc-compile/src/compiler.rs | 7 +++--- midenc-compile/src/lib.rs | 12 ++++++---- midenc-compile/src/stages/assemble.rs | 2 +- midenc-compile/src/stages/codegen.rs | 9 ++++--- midenc-compile/src/stages/link.rs | 4 ++-- midenc-compile/src/stages/mod.rs | 4 ++-- midenc-compile/src/stages/parse.rs | 10 ++++---- midenc-compile/src/stages/rewrite.rs | 2 +- midenc-driver/src/lib.rs | 2 +- midenc-driver/src/midenc.rs | 2 +- midenc-session/src/diagnostics.rs | 3 +-- midenc-session/src/emitter.rs | 2 +- midenc-session/src/flags/arg_matches.rs | 4 ++-- midenc-session/src/libs.rs | 6 ++--- midenc-session/src/options/mod.rs | 2 +- midenc/src/main.rs | 3 +-- .../src/account_component_metadata.rs | 4 ++-- .../src/component_macro/generate_wit.rs | 4 ++-- sdk/base-macros/src/export_type.rs | 2 +- sdk/base-macros/src/generate.rs | 6 ++--- sdk/base-macros/src/script.rs | 2 +- sdk/base-macros/src/types.rs | 8 ++----- sdk/base/src/types/storage.rs | 2 +- sdk/stdlib-sys/src/intrinsics/mod.rs | 2 +- sdk/stdlib-sys/src/lib.rs | 2 +- .../integration-node/src/local_node/handle.rs | 2 +- tests/integration-node/src/local_node/mod.rs | 2 +- .../src/local_node/process.rs | 4 ++-- .../src/node_tests/basic_wallet.rs | 2 +- .../src/node_tests/counter_contract.rs | 2 +- .../node_tests/counter_contract_no_auth.rs | 2 +- .../node_tests/counter_contract_rust_auth.rs | 4 ++-- .../src/node_tests/helpers.rs | 8 +++---- .../integration/src/codegen/intrinsics/mem.rs | 4 ++-- tests/integration/src/codegen/operations.rs | 4 ++-- .../abi_transform/advice_map.rs | 4 ++-- .../rust_masm_tests/abi_transform/stdlib.rs | 4 ++-- .../abi_transform/tx_kernel.rs | 2 +- .../src/rust_masm_tests/examples.rs | 4 ++-- .../src/rust_masm_tests/instructions.rs | 2 +- .../src/rust_masm_tests/intrinsics.rs | 2 +- .../rust_sdk/stdlib/collections.rs | 2 +- .../rust_masm_tests/rust_sdk/stdlib/hashes.rs | 2 +- tests/integration/src/testing/eval.rs | 4 ++-- tests/integration/src/testing/setup.rs | 2 +- tools/cargo-miden/src/compile_masm.rs | 2 +- tools/cargo-miden/src/config.rs | 2 +- tools/cargo-miden/src/dependencies.rs | 6 ++--- tools/cargo-miden/src/main.rs | 2 +- tools/cargo-miden/src/target.rs | 2 +- tools/cargo-miden/src/template.rs | 4 ++-- 204 files changed, 447 insertions(+), 462 deletions(-) diff --git a/benches/benches/is_prime_bench.rs b/benches/benches/is_prime_bench.rs index 488c6450a..a88ee388f 100644 --- a/benches/benches/is_prime_bench.rs +++ b/benches/benches/is_prime_bench.rs @@ -4,7 +4,7 @@ use std::{hint::black_box, path::PathBuf}; -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, criterion_group, criterion_main}; use midenc_benchmark_runner::BenchmarkRunner; fn bench_is_prime_compilation(c: &mut Criterion) { diff --git a/codegen/masm/src/artifact.rs b/codegen/masm/src/artifact.rs index 47c8b79c2..1ba70a649 100644 --- a/codegen/masm/src/artifact.rs +++ b/codegen/masm/src/artifact.rs @@ -4,16 +4,16 @@ use alloc::{ }; use core::fmt; -use miden_assembly::{ast::InvocationTarget, library::LibraryExport, Library}; +use miden_assembly::{Library, ast::InvocationTarget, library::LibraryExport}; use miden_core::{Program, Word}; use miden_mast_package::{MastArtifact, Package, ProcedureName}; use midenc_hir::{constants::ConstantData, dialects::builtin, interner::Symbol}; use midenc_session::{ - diagnostics::{Report, SourceSpan, Span}, Session, + diagnostics::{Report, SourceSpan, Span}, }; -use crate::{lower::NativePtr, masm, TraceEvent}; +use crate::{TraceEvent, lower::NativePtr, masm}; pub struct MasmComponent { pub id: builtin::ComponentId, diff --git a/codegen/masm/src/emit/binary.rs b/codegen/masm/src/emit/binary.rs index 198913f75..e8f8e6702 100644 --- a/codegen/masm/src/emit/binary.rs +++ b/codegen/masm/src/emit/binary.rs @@ -3,7 +3,7 @@ use core::assert_matches::assert_matches; use miden_core::Felt; use midenc_hir::{Immediate, Overflow, SourceSpan, Type}; -use super::{masm, OpEmitter}; +use super::{OpEmitter, masm}; impl OpEmitter<'_> { pub fn eq(&mut self, span: SourceSpan) { @@ -976,7 +976,7 @@ impl OpEmitter<'_> { span, ); self.band_int64(span); // [band_hi_hi, band_hi_lo, b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo] - // AND the low bits + // AND the low bits self.emit_all( [ // [b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo, band_hi_hi, band_hi_lo] @@ -1028,7 +1028,7 @@ impl OpEmitter<'_> { span, ); self.band_int64(span); // [band_hi_hi, band_hi_lo, b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo] - // AND the low bits + // AND the low bits self.emit_all( [ // [b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo, band_hi_hi, band_hi_lo] @@ -1086,7 +1086,7 @@ impl OpEmitter<'_> { span, ); self.bor_int64(span); // [band_hi_hi, band_hi_lo, b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo] - // OR the low bits + // OR the low bits self.emit_all( [ // [b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo, band_hi_hi, band_hi_lo] @@ -1138,7 +1138,7 @@ impl OpEmitter<'_> { span, ); self.bor_int64(span); // [band_hi_hi, band_hi_lo, b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo] - // OR the low bits + // OR the low bits self.emit_all( [ // [b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo, band_hi_hi, band_hi_lo] @@ -1196,7 +1196,7 @@ impl OpEmitter<'_> { span, ); self.bxor_int64(span); // [band_hi_hi, band_hi_lo, b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo] - // XOR the low bits + // XOR the low bits self.emit_all( [ // [b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo, band_hi_hi, band_hi_lo] @@ -1250,7 +1250,7 @@ impl OpEmitter<'_> { span, ); self.bxor_int64(span); // [band_hi_hi, band_hi_lo, b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo] - // XOR the low bits + // XOR the low bits self.emit_all( [ // [b_lo_hi, b_lo_lo, a_lo_hi, a_lo_lo, band_hi_hi, band_hi_lo] diff --git a/codegen/masm/src/emit/felt.rs b/codegen/masm/src/emit/felt.rs index b08ab8395..7fe9b92b5 100644 --- a/codegen/masm/src/emit/felt.rs +++ b/codegen/masm/src/emit/felt.rs @@ -1,7 +1,7 @@ use miden_core::{Felt, FieldElement}; use midenc_hir::SourceSpan; -use super::{masm, OpEmitter}; +use super::{OpEmitter, masm}; /// The value zero, as a field element pub const ZERO: Felt = Felt::ZERO; diff --git a/codegen/masm/src/emit/int128.rs b/codegen/masm/src/emit/int128.rs index 9d14ba8e6..e9fb267fd 100644 --- a/codegen/masm/src/emit/int128.rs +++ b/codegen/masm/src/emit/int128.rs @@ -1,6 +1,6 @@ use midenc_hir::{Overflow, SourceSpan}; -use super::{masm, OpEmitter}; +use super::{OpEmitter, masm}; #[allow(unused)] impl OpEmitter<'_> { diff --git a/codegen/masm/src/emit/int32.rs b/codegen/masm/src/emit/int32.rs index 8c8cb8fca..84de430ca 100644 --- a/codegen/masm/src/emit/int32.rs +++ b/codegen/masm/src/emit/int32.rs @@ -1,7 +1,7 @@ use miden_core::{Felt, FieldElement}; use midenc_hir::{Overflow, SourceSpan}; -use super::{dup_from_offset, felt, masm, movup_from_offset, OpEmitter}; +use super::{OpEmitter, dup_from_offset, felt, masm, movup_from_offset}; pub const SIGN_BIT: u32 = 1 << 31; @@ -429,7 +429,7 @@ impl OpEmitter<'_> { Overflow::Unchecked => masm::Instruction::Add, Overflow::Checked => { return self - .emit_all([masm::Instruction::Add, masm::Instruction::U32Assert], span) + .emit_all([masm::Instruction::Add, masm::Instruction::U32Assert], span); } Overflow::Wrapping => masm::Instruction::U32WrappingAdd, Overflow::Overflowing => masm::Instruction::U32OverflowingAdd, @@ -556,7 +556,7 @@ impl OpEmitter<'_> { masm::Instruction::U32Assert, ], span, - ) + ); } Overflow::Wrapping => masm::Instruction::U32WrappingSubImm(imm.into()), Overflow::Overflowing => masm::Instruction::U32OverflowingSubImm(imm.into()), @@ -599,7 +599,7 @@ impl OpEmitter<'_> { Overflow::Unchecked => masm::Instruction::Mul, Overflow::Checked => { return self - .emit_all([masm::Instruction::Mul, masm::Instruction::U32Assert], span) + .emit_all([masm::Instruction::Mul, masm::Instruction::U32Assert], span); } Overflow::Wrapping => masm::Instruction::U32WrappingMul, Overflow::Overflowing => masm::Instruction::U32OverflowingMul, @@ -650,7 +650,7 @@ impl OpEmitter<'_> { masm::Instruction::U32Assert, ], span, - ) + ); } Overflow::Wrapping => masm::Instruction::U32WrappingMulImm(imm.into()), Overflow::Overflowing => { diff --git a/codegen/masm/src/emit/int64.rs b/codegen/masm/src/emit/int64.rs index 2a18ead5a..47972558b 100644 --- a/codegen/masm/src/emit/int64.rs +++ b/codegen/masm/src/emit/int64.rs @@ -1,7 +1,7 @@ use miden_core::{Felt, FieldElement}; use midenc_hir::{Overflow, SourceSpan, Span}; -use super::{dup_from_offset, masm, movup_from_offset, OpEmitter, P}; +use super::{OpEmitter, P, dup_from_offset, masm, movup_from_offset}; #[allow(unused)] impl OpEmitter<'_> { diff --git a/codegen/masm/src/emit/mem.rs b/codegen/masm/src/emit/mem.rs index 89925384d..8a9a29162 100644 --- a/codegen/masm/src/emit/mem.rs +++ b/codegen/masm/src/emit/mem.rs @@ -1,10 +1,10 @@ use miden_core::{Felt, FieldElement}; use midenc_hir::{ - dialects::builtin::LocalVariable, AddressSpace, ArrayType, PointerType, SourceSpan, StructType, - Type, + AddressSpace, ArrayType, PointerType, SourceSpan, StructType, Type, + dialects::builtin::LocalVariable, }; -use super::{masm, OpEmitter}; +use super::{OpEmitter, masm}; use crate::lower::NativePtr; /// Allocation diff --git a/codegen/masm/src/emit/mod.rs b/codegen/masm/src/emit/mod.rs index 758f0e9f5..c5d6fafa5 100644 --- a/codegen/masm/src/emit/mod.rs +++ b/codegen/masm/src/emit/mod.rs @@ -95,8 +95,8 @@ use midenc_hir::{Immediate, Operation, SourceSpan, Type, ValueRef}; use super::{Operand, OperandStack}; use crate::{ - masm::{self as masm, Op}, TraceEvent, + masm::{self as masm, Op}, }; /// This structure is used to emit the Miden Assembly ops corresponding to an IR instruction. @@ -841,9 +841,9 @@ mod tests { assert_eq!(&ops[12], &Op::Inst(Span::new(span, masm::Instruction::MovDn6))); // [three, five_c, five_d, four_a, four_b, five_a, five_b] assert_eq!(&ops[13], &Op::Inst(Span::new(span, masm::Instruction::MovUp4))); // [four_b, three, five_c, five_d, four_a, five_a, five_b] assert_eq!(&ops[14], &Op::Inst(Span::new(span, masm::Instruction::MovUp4))); // [four_a, four_b, three, five_c, - // five_d, - // five_a, - // five_b] + // five_d, + // five_a, + // five_b] } emitter.movdn(2, SourceSpan::default()); @@ -862,9 +862,9 @@ mod tests { assert_eq!(&ops[14], &Op::Inst(Span::new(span, masm::Instruction::MovUp4))); // [four_a, four_b, three, five_c, five_d, five_a, five_b] assert_eq!(&ops[15], &Op::Inst(Span::new(span, masm::Instruction::MovDn4))); // [four_b, three, five_c, five_d, four_a, five_a, five_b] assert_eq!(&ops[16], &Op::Inst(Span::new(span, masm::Instruction::MovDn4))); // [three, five_c, five_d, four_a, - // four_b, - // five_a, - // five_b] + // four_b, + // five_a, + // five_b] } emitter.movup(2, SourceSpan::default()); @@ -881,9 +881,9 @@ mod tests { assert_eq!(&ops[16], &Op::Inst(Span::new(span, masm::Instruction::MovDn4))); // [three, five_c, five_d, four_a, four_b, five_a, five_b] assert_eq!(&ops[17], &Op::Inst(Span::new(span, masm::Instruction::MovUp4))); // [four_b, three, five_c, five_d, four_a, five_a, five_b] assert_eq!(&ops[18], &Op::Inst(Span::new(span, masm::Instruction::MovUp4))); // [four_a, four_b, three, five_c, - // five_d, - // five_a, - // five_b] + // five_d, + // five_a, + // five_b] } emitter.drop(SourceSpan::default()); diff --git a/codegen/masm/src/emit/primop.rs b/codegen/masm/src/emit/primop.rs index 1ea4ab75b..57d3640dd 100644 --- a/codegen/masm/src/emit/primop.rs +++ b/codegen/masm/src/emit/primop.rs @@ -4,7 +4,7 @@ use midenc_hir::{ Type, }; -use super::{int64, masm, OpEmitter}; +use super::{OpEmitter, int64, masm}; use crate::TraceEvent; impl OpEmitter<'_> { diff --git a/codegen/masm/src/emit/smallint.rs b/codegen/masm/src/emit/smallint.rs index 1c314cd2c..aceadaf6b 100644 --- a/codegen/masm/src/emit/smallint.rs +++ b/codegen/masm/src/emit/smallint.rs @@ -10,7 +10,7 @@ //! those primitives. use midenc_hir::{Overflow, SourceSpan}; -use super::{masm, OpEmitter}; +use super::{OpEmitter, masm}; #[allow(unused)] impl OpEmitter<'_> { diff --git a/codegen/masm/src/emit/unary.rs b/codegen/masm/src/emit/unary.rs index 328d2b65a..051f26534 100644 --- a/codegen/masm/src/emit/unary.rs +++ b/codegen/masm/src/emit/unary.rs @@ -537,9 +537,9 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::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 + // 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 self.emit_push(0u32, span); // [0, lo_clz, hi_clz] self.emit(masm::Instruction::Dup2, span); // [hi_clz, 0, lo_clz, hi_clz] self.emit_push(Felt::new(32), span); @@ -621,8 +621,8 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::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 + // 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] self.emit(masm::Instruction::Dup2, span); // [hi_clo, 0, lo_clo, hi_clo] self.emit_push(Felt::new(32), span); @@ -713,9 +713,9 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::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 + // 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 self.emit(masm::Instruction::Swap1, span); self.emit_push(0u32, span); // [0, hi_ctz, lo_ctz] self.emit(masm::Instruction::Dup2, span); // [lo_ctz, 0, hi_ctz, lo_ctz] @@ -809,8 +809,8 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::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 + // 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); self.emit_push(0u32, span); // [0, hi_cto, lo_cto] self.emit(masm::Instruction::Dup2, span); // [lo_cto, 0, hi_cto, lo_cto] diff --git a/codegen/masm/src/emitter.rs b/codegen/masm/src/emitter.rs index 9c08f0d78..385c0ade7 100644 --- a/codegen/masm/src/emitter.rs +++ b/codegen/masm/src/emitter.rs @@ -7,11 +7,11 @@ use midenc_session::diagnostics::{SourceSpan, Spanned}; use smallvec::SmallVec; use crate::{ + Constraint, OperandStack, emit::{InstOpEmitter, OpEmitter}, linker::LinkInfo, masm, - opt::{operands::SolverOptions, OperandMovementConstraintSolver, SolverError}, - Constraint, OperandStack, + opt::{OperandMovementConstraintSolver, SolverError, operands::SolverOptions}, }; pub(crate) struct BlockEmitter<'b> { diff --git a/codegen/masm/src/intrinsics.rs b/codegen/masm/src/intrinsics.rs index 391a396cb..6f75315fe 100644 --- a/codegen/masm/src/intrinsics.rs +++ b/codegen/masm/src/intrinsics.rs @@ -1,6 +1,6 @@ use miden_assembly::{ - ast::{Module, ModuleKind}, LibraryPath, + ast::{Module, ModuleKind}, }; use midenc_session::diagnostics::{PrintDiagnostic, SourceLanguage, SourceManager, Uri}; diff --git a/codegen/masm/src/lib.rs b/codegen/masm/src/lib.rs index 997989a92..4cba3d36e 100644 --- a/codegen/masm/src/lib.rs +++ b/codegen/masm/src/lib.rs @@ -19,17 +19,17 @@ mod stack; pub mod masm { pub use miden_assembly_syntax::{ + KernelLibrary, Library, LibraryNamespace, LibraryPath, ast::*, debuginfo::{SourceSpan, Span, Spanned}, parser::{IntValue, PushValue}, - KernelLibrary, Library, LibraryNamespace, LibraryPath, }; } pub(crate) use self::lower::HirLowering; pub use self::{ artifact::{MasmComponent, Rodata}, - events::{TraceEvent, TRACE_FRAME_END, TRACE_FRAME_START}, + events::{TRACE_FRAME_END, TRACE_FRAME_START, TraceEvent}, lower::{NativePtr, ToMasmComponent}, stack::{Constraint, Operand, OperandStack}, }; diff --git a/codegen/masm/src/lower/component.rs b/codegen/masm/src/lower/component.rs index 81c9ec8d9..a9c3a1039 100644 --- a/codegen/masm/src/lower/component.rs +++ b/codegen/masm/src/lower/component.rs @@ -1,30 +1,31 @@ use alloc::{collections::BTreeSet, sync::Arc}; -use miden_assembly::{ast::InvocationTarget, LibraryPath}; +use miden_assembly::{LibraryPath, ast::InvocationTarget}; use miden_assembly_syntax::parser::WordValue; use miden_mast_package::ProcedureName; use midenc_hir::{ - diagnostics::IntoDiagnostic, dialects::builtin, pass::AnalysisManager, CallConv, FunctionIdent, - Op, SourceSpan, Span, Symbol, ValueRef, + CallConv, FunctionIdent, Op, SourceSpan, Span, Symbol, ValueRef, diagnostics::IntoDiagnostic, + dialects::builtin, pass::AnalysisManager, }; use midenc_hir_analysis::analyses::LivenessAnalysis; use midenc_session::{ - diagnostics::{Report, Spanned}, TargetEnv, + diagnostics::{Report, Spanned}, }; use smallvec::SmallVec; use crate::{ + TraceEvent, artifact::MasmComponent, emitter::BlockEmitter, linker::{LinkInfo, Linker}, - masm, TraceEvent, + masm, }; /// This trait represents a conversion pass from some HIR entity to a Miden Assembly component. pub trait ToMasmComponent { fn to_masm_component(&self, analysis_manager: AnalysisManager) - -> Result; + -> Result; } /// 1:1 conversion from HIR component to MASM component @@ -138,7 +139,7 @@ impl ToMasmComponent for builtin::Component { fn data_segments_to_rodata(link_info: &LinkInfo) -> Result, Report> { use midenc_hir::constants::ConstantData; - use crate::data_segments::{merge_data_segments, ResolvedDataSegment}; + use crate::data_segments::{ResolvedDataSegment, merge_data_segments}; let mut resolved = SmallVec::<[ResolvedDataSegment; 2]>::new(); for sref in link_info.segment_layout().iter() { let s = sref.borrow(); diff --git a/codegen/masm/src/lower/lowering.rs b/codegen/masm/src/lower/lowering.rs index 633c116c5..c1e31d76a 100644 --- a/codegen/masm/src/lower/lowering.rs +++ b/codegen/masm/src/lower/lowering.rs @@ -4,15 +4,15 @@ 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, dialects::builtin, traits::{BinaryOp, Commutative}, - Op, OpExt, Span, SymbolTable, Value, ValueRange, ValueRef, }; use midenc_session::diagnostics::{Report, Severity, Spanned}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use super::*; -use crate::{emitter::BlockEmitter, masm, opt::operands::SolverOptions, Constraint}; +use crate::{Constraint, emitter::BlockEmitter, masm, opt::operands::SolverOptions}; /// This trait is registered with all ops, of all dialects, which are legal for lowering to MASM. /// diff --git a/codegen/masm/src/lower/utils.rs b/codegen/masm/src/lower/utils.rs index 6cd932b4c..b22a37af3 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::{emitter::BlockEmitter, masm, Constraint}; +use crate::{Constraint, emitter::BlockEmitter, masm}; /// Emit a conditonal branch-like region, e.g. `scf.if`. /// @@ -493,16 +493,16 @@ mod tests { use midenc_dialect_scf::StructuredControlFlowOpBuilder; use midenc_expect_test::expect_file; use midenc_hir::{ + AbiParam, Context, Ident, OpBuilder, Signature, Type, dialects::builtin::{self, BuiltinOpBuilder, FunctionBuilder, FunctionRef}, formatter::PrettyPrint, pass::AnalysisManager, version::Version, - AbiParam, Context, Ident, OpBuilder, Signature, Type, }; use midenc_hir_analysis::analyses::LivenessAnalysis; use super::*; - use crate::{linker::LinkInfo, OperandStack}; + use crate::{OperandStack, linker::LinkInfo}; #[test] fn util_emit_if_test() -> Result<(), Report> { diff --git a/codegen/masm/src/opt/operands/context.rs b/codegen/masm/src/opt/operands/context.rs index d49da1bba..520f5b752 100644 --- a/codegen/masm/src/opt/operands/context.rs +++ b/codegen/masm/src/opt/operands/context.rs @@ -1,6 +1,6 @@ use core::num::NonZeroU8; -use midenc_hir::{self as hir, hashbrown, FxHashMap}; +use midenc_hir::{self as hir, FxHashMap, hashbrown}; use smallvec::SmallVec; use super::{SolverError, SolverOptions, Stack, ValueOrAlias}; diff --git a/codegen/masm/src/opt/operands/tactics/two_args.rs b/codegen/masm/src/opt/operands/tactics/two_args.rs index c1f141454..6d4033cdd 100644 --- a/codegen/masm/src/opt/operands/tactics/two_args.rs +++ b/codegen/masm/src/opt/operands/tactics/two_args.rs @@ -221,8 +221,8 @@ mod tests { use super::*; use crate::{ - opt::{operands::SolverOptions, SolverError}, Constraint, OperandStack, + opt::{SolverError, operands::SolverOptions}, }; // These are actually RHS/LHS pairs. diff --git a/dialects/arith/src/builders.rs b/dialects/arith/src/builders.rs index baed65142..c368b0038 100644 --- a/dialects/arith/src/builders.rs +++ b/dialects/arith/src/builders.rs @@ -1,6 +1,6 @@ use midenc_hir::{ - dialects::builtin::FunctionBuilder, Builder, BuilderExt, Felt, OpBuilder, Overflow, Report, - SourceSpan, ValueRef, + Builder, BuilderExt, Felt, OpBuilder, Overflow, Report, SourceSpan, ValueRef, + dialects::builtin::FunctionBuilder, }; use crate::*; diff --git a/dialects/cf/src/builders.rs b/dialects/cf/src/builders.rs index 0e19a15fe..5fa3db090 100644 --- a/dialects/cf/src/builders.rs +++ b/dialects/cf/src/builders.rs @@ -1,6 +1,6 @@ use midenc_hir::{ - dialects::builtin::FunctionBuilder, BlockRef, Builder, BuilderExt, OpBuilder, Report, - SourceSpan, UnsafeIntrusiveEntityRef, ValueRef, + BlockRef, Builder, BuilderExt, OpBuilder, Report, SourceSpan, UnsafeIntrusiveEntityRef, + ValueRef, dialects::builtin::FunctionBuilder, }; use crate::*; diff --git a/dialects/hir/src/attributes/pointer.rs b/dialects/hir/src/attributes/pointer.rs index 6f531f796..0bcaae9d5 100644 --- a/dialects/hir/src/attributes/pointer.rs +++ b/dialects/hir/src/attributes/pointer.rs @@ -1,6 +1,6 @@ use alloc::boxed::Box; -use midenc_hir::{formatter, AttributeValue, Immediate, Type}; +use midenc_hir::{AttributeValue, Immediate, Type, formatter}; /// Represents a constant pointer value #[derive(Debug, Clone, PartialEq, Eq, Hash)] diff --git a/dialects/hir/src/builders.rs b/dialects/hir/src/builders.rs index 26c106907..7db4a05e9 100644 --- a/dialects/hir/src/builders.rs +++ b/dialects/hir/src/builders.rs @@ -1,6 +1,6 @@ use midenc_hir::{ - dialects::builtin::*, AsCallableSymbolRef, Builder, Immediate, Op, OpBuilder, PointerType, - Report, Signature, SourceSpan, Type, UnsafeIntrusiveEntityRef, ValueRef, + AsCallableSymbolRef, Builder, Immediate, Op, OpBuilder, PointerType, Report, Signature, + SourceSpan, Type, UnsafeIntrusiveEntityRef, ValueRef, dialects::builtin::*, }; use crate::*; diff --git a/dialects/hir/src/transforms/spill.rs b/dialects/hir/src/transforms/spill.rs index 1f04093a3..1efde02df 100644 --- a/dialects/hir/src/transforms/spill.rs +++ b/dialects/hir/src/transforms/spill.rs @@ -1,11 +1,11 @@ use alloc::rc::Rc; use midenc_hir::{ + BlockRef, BuilderExt, EntityMut, Op, OpBuilder, OperationName, OperationRef, Report, Rewriter, + SourceSpan, Spanned, Symbol, ValueRef, adt::SmallDenseMap, dialects::builtin::{Function, FunctionRef, LocalVariable}, pass::{Pass, PassExecutionState, PostPassStatus}, - BlockRef, BuilderExt, EntityMut, Op, OpBuilder, OperationName, OperationRef, Report, Rewriter, - SourceSpan, Spanned, Symbol, ValueRef, }; use midenc_hir_analysis::analyses::SpillAnalysis; use midenc_hir_transform::{self as transforms, ReloadLike, SpillLike, TransformSpillsInterface}; diff --git a/dialects/hir/src/transforms/spill/tests.rs b/dialects/hir/src/transforms/spill/tests.rs index d1775ade7..32e680141 100644 --- a/dialects/hir/src/transforms/spill/tests.rs +++ b/dialects/hir/src/transforms/spill/tests.rs @@ -5,13 +5,13 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_cf::ControlFlowOpBuilder as Cf; use midenc_expect_test::expect_file; use midenc_hir::{ - dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder}, - pass::{Nesting, PassManager}, AbiParam, AddressSpace, Builder, Context, Ident, Op, OpBuilder, PointerType, Report, Signature, SourceSpan, Type, ValueRef, + dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder}, + pass::{Nesting, PassManager}, }; -use crate::{transforms::TransformSpills, HirOpBuilder}; +use crate::{HirOpBuilder, transforms::TransformSpills}; type TestResult = Result; diff --git a/dialects/scf/src/builders.rs b/dialects/scf/src/builders.rs index 9d2445eba..523e4911f 100644 --- a/dialects/scf/src/builders.rs +++ b/dialects/scf/src/builders.rs @@ -1,6 +1,6 @@ use midenc_hir::{ - dialects::builtin::FunctionBuilder, ArrayAttr, Builder, BuilderExt, OpBuilder, Region, Report, - SourceSpan, Type, UnsafeIntrusiveEntityRef, ValueRef, + ArrayAttr, Builder, BuilderExt, OpBuilder, Region, Report, SourceSpan, Type, + UnsafeIntrusiveEntityRef, ValueRef, dialects::builtin::FunctionBuilder, }; use crate::*; diff --git a/dialects/scf/src/canonicalization/fold_redundant_yields.rs b/dialects/scf/src/canonicalization/fold_redundant_yields.rs index 80ad825d2..06ea171a3 100644 --- a/dialects/scf/src/canonicalization/fold_redundant_yields.rs +++ b/dialects/scf/src/canonicalization/fold_redundant_yields.rs @@ -173,6 +173,7 @@ mod tests { use midenc_dialect_cf::{ControlFlowOpBuilder, SwitchCase}; use midenc_expect_test::expect_file; use midenc_hir::{ + AbiParam, BuilderExt, Context, Ident, OpBuilder, Report, Signature, SourceSpan, Type, dialects::{ builtin::{self, BuiltinOpBuilder, FunctionBuilder}, test::TestOpBuilder, @@ -181,7 +182,6 @@ mod tests { patterns::{ FrozenRewritePatternSet, GreedyRewriteConfig, RewritePattern, RewritePatternSet, }, - AbiParam, BuilderExt, Context, Ident, OpBuilder, Report, Signature, SourceSpan, Type, }; use super::*; diff --git a/dialects/scf/src/transforms/cfg_to_scf.rs b/dialects/scf/src/transforms/cfg_to_scf.rs index bece00afd..be7ad3c2b 100644 --- a/dialects/scf/src/transforms/cfg_to_scf.rs +++ b/dialects/scf/src/transforms/cfg_to_scf.rs @@ -4,12 +4,12 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_cf::{self as cf, ControlFlowOpBuilder}; use midenc_dialect_ub::UndefinedBehaviorOpBuilder; use midenc_hir::{ + Builder, EntityMut, Forward, Op, Operation, OperationName, OperationRef, RawWalk, Report, + SmallVec, Spanned, Type, ValueRange, ValueRef, WalkResult, diagnostics::Severity, dialects::builtin, dominance::DominanceInfo, pass::{Pass, PassExecutionState, PostPassStatus}, - Builder, EntityMut, Forward, Op, Operation, OperationName, OperationRef, RawWalk, Report, - SmallVec, Spanned, Type, ValueRange, ValueRef, WalkResult, }; use midenc_hir_transform::{self as transforms, CFGToSCFInterface}; @@ -379,8 +379,8 @@ mod tests { use builtin::{BuiltinOpBuilder, FunctionBuilder}; use midenc_expect_test::expect_file; use midenc_hir::{ - dialects::builtin, pass, AbiParam, BuilderExt, Context, Ident, OpBuilder, PointerType, - Report, Signature, SourceSpan, Type, + AbiParam, BuilderExt, Context, Ident, OpBuilder, PointerType, Report, Signature, + SourceSpan, Type, dialects::builtin, pass, }; use super::*; diff --git a/dialects/ub/src/attributes/poison.rs b/dialects/ub/src/attributes/poison.rs index 5315362e3..64e107e69 100644 --- a/dialects/ub/src/attributes/poison.rs +++ b/dialects/ub/src/attributes/poison.rs @@ -1,6 +1,6 @@ use alloc::boxed::Box; -use midenc_hir::{formatter, AttributeValue, Felt, Immediate, Type}; +use midenc_hir::{AttributeValue, Felt, Immediate, Type, formatter}; /// Represents the constant value of the 'hir.poison' operation #[derive(Debug, Clone, PartialEq, Eq, Hash)] diff --git a/dialects/ub/src/builders.rs b/dialects/ub/src/builders.rs index 9568723ac..573c21f27 100644 --- a/dialects/ub/src/builders.rs +++ b/dialects/ub/src/builders.rs @@ -1,6 +1,6 @@ use midenc_hir::{ - dialects::builtin::FunctionBuilder, Builder, BuilderExt, OpBuilder, SourceSpan, Type, - UnsafeIntrusiveEntityRef, ValueRef, + Builder, BuilderExt, OpBuilder, SourceSpan, Type, UnsafeIntrusiveEntityRef, ValueRef, + dialects::builtin::FunctionBuilder, }; use crate::*; diff --git a/eval/src/eval.rs b/eval/src/eval.rs index f274c98b5..5c119836a 100644 --- a/eval/src/eval.rs +++ b/eval/src/eval.rs @@ -10,9 +10,9 @@ use midenc_dialect_hir as hir; use midenc_dialect_scf as scf; use midenc_dialect_ub as ub; use midenc_hir::{ - dialects::builtin, AttributeValue, Felt, Immediate, Op, OperationRef, Overflow, - RegionBranchPoint, RegionBranchTerminatorOpInterface, Report, SmallVec, SourceSpan, Spanned, - SuccessorInfo, Type, Value as _, ValueRange, + AttributeValue, Felt, Immediate, Op, OperationRef, Overflow, RegionBranchPoint, + RegionBranchTerminatorOpInterface, Report, SmallVec, SourceSpan, Spanned, SuccessorInfo, Type, + Value as _, ValueRange, dialects::builtin, }; use midenc_session::diagnostics::Severity; @@ -735,9 +735,7 @@ impl Eval for arith::Constant { } macro_rules! binop { - ($op:ident, $evaluator:ident, $operator:ident) => {{ - binop!($op, $evaluator, $operator, $operator) - }}; + ($op:ident, $evaluator:ident, $operator:ident) => {{ binop!($op, $evaluator, $operator, $operator) }}; ($op:ident, $evaluator:ident, $operator:ident, $felt_operator:ident) => {{ let lhs = $op.lhs(); @@ -1670,9 +1668,7 @@ impl Eval for arith::Sext { } macro_rules! unaryop { - ($op:ident, $evaluator:ident, $operator:ident) => {{ - unaryop!($op, $evaluator, $operator, $operator) - }}; + ($op:ident, $evaluator:ident, $operator:ident) => {{ unaryop!($op, $evaluator, $operator, $operator) }}; ($op:ident, $evaluator:ident, $operator:ident, $felt_operator:ident) => {{ let lhs = $op.operand(); diff --git a/eval/src/evaluator.rs b/eval/src/evaluator.rs index ac807a4d3..b1452d5b6 100644 --- a/eval/src/evaluator.rs +++ b/eval/src/evaluator.rs @@ -5,11 +5,11 @@ mod memory; use alloc::{format, rc::Rc, string::ToString, vec, vec::Vec}; use midenc_hir::{ + CallableOpInterface, Context, Immediate, Operation, OperationRef, RegionBranchPoint, RegionRef, + Report, SmallVec, SourceSpan, Spanned, SymbolPath, Type, Value as _, ValueRange, ValueRef, dialects::builtin::{ComponentId, LocalVariable}, formatter::DisplayValues, - smallvec, CallableOpInterface, Context, Immediate, Operation, OperationRef, RegionBranchPoint, - RegionRef, Report, SmallVec, SourceSpan, Spanned, SymbolPath, Type, Value as _, ValueRange, - ValueRef, + smallvec, }; use midenc_session::diagnostics::{InFlightDiagnosticBuilder, Severity}; diff --git a/eval/src/evaluator/context.rs b/eval/src/evaluator/context.rs index a7bd8bffe..4c65191be 100644 --- a/eval/src/evaluator/context.rs +++ b/eval/src/evaluator/context.rs @@ -1,6 +1,6 @@ use alloc::vec::Vec; -use midenc_hir::{dialects::builtin::ComponentId, Report, SourceSpan, Type}; +use midenc_hir::{Report, SourceSpan, Type, dialects::builtin::ComponentId}; use midenc_session::diagnostics::WrapErr; use super::memory::{self, ReadFailed, WriteFailed}; diff --git a/eval/src/evaluator/frame.rs b/eval/src/evaluator/frame.rs index 0b7ac8699..f79c83724 100644 --- a/eval/src/evaluator/frame.rs +++ b/eval/src/evaluator/frame.rs @@ -3,12 +3,12 @@ use alloc::{format, vec}; use midenc_hir::{ - dialects::builtin::{self, LocalVariable}, - formatter::DisplayHex, BlockRef, Context, EntityRef, Felt, FxHashMap, Immediate, Operation, OperationRef, Report, SmallVec, SourceSpan, SymbolPath, ValueId, ValueRef, + dialects::builtin::{self, LocalVariable}, + formatter::DisplayHex, }; -use midenc_session::diagnostics::{miette, Diagnostic, Severity, WrapErr}; +use midenc_session::diagnostics::{Diagnostic, Severity, WrapErr, miette}; use super::memory; use crate::Value; diff --git a/eval/src/evaluator/memory.rs b/eval/src/evaluator/memory.rs index 2dfb0eaa2..2d4cf0f2c 100644 --- a/eval/src/evaluator/memory.rs +++ b/eval/src/evaluator/memory.rs @@ -5,7 +5,7 @@ use core::ops::{Index, IndexMut, Range}; use midenc_hir::{Felt, FieldElement, Immediate, SmallVec, SourceSpan, Type}; use midenc_session::{ - diagnostics::{miette, Diagnostic}, + diagnostics::{Diagnostic, miette}, miden_assembly::utils::Deserializable, }; diff --git a/eval/src/tests.rs b/eval/src/tests.rs index 845e380fd..fb5168d17 100644 --- a/eval/src/tests.rs +++ b/eval/src/tests.rs @@ -5,9 +5,9 @@ use midenc_dialect_cf::ControlFlowOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_dialect_scf::StructuredControlFlowOpBuilder; use midenc_hir::{ - dialects::builtin::{BuiltinOpBuilder, FunctionBuilder}, AbiParam, Builder, Context, Ident, Op, OpBuilder, ProgramPoint, Report, Signature, SourceSpan, SymbolTable, Type, ValueRef, + dialects::builtin::{BuiltinOpBuilder, FunctionBuilder}, }; use crate::*; diff --git a/eval/src/value.rs b/eval/src/value.rs index b48f7b4c3..06e36f9c9 100644 --- a/eval/src/value.rs +++ b/eval/src/value.rs @@ -1,5 +1,5 @@ use midenc_hir::{Immediate, SourceSpan, Type, ValueRef}; -use midenc_session::diagnostics::{miette, Diagnostic}; +use midenc_session::diagnostics::{Diagnostic, miette}; #[derive(Debug, thiserror::Error, Diagnostic)] pub enum InvalidCastError { diff --git a/frontend/wasm/src/callable.rs b/frontend/wasm/src/callable.rs index 670133805..bf26384e4 100644 --- a/frontend/wasm/src/callable.rs +++ b/frontend/wasm/src/callable.rs @@ -1,4 +1,4 @@ -use midenc_hir::{dialects::builtin::FunctionRef, interner::Symbol, Signature, SymbolPath}; +use midenc_hir::{Signature, SymbolPath, dialects::builtin::FunctionRef, interner::Symbol}; use crate::intrinsics::Intrinsic; diff --git a/frontend/wasm/src/code_translator/mod.rs b/frontend/wasm/src/code_translator/mod.rs index 233420af4..c3a8a40e9 100644 --- a/frontend/wasm/src/code_translator/mod.rs +++ b/frontend/wasm/src/code_translator/mod.rs @@ -15,13 +15,13 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_cf::{ControlFlowOpBuilder, SwitchCase}; -use midenc_dialect_hir::{assertions, HirOpBuilder}; +use midenc_dialect_hir::{HirOpBuilder, assertions}; use midenc_dialect_ub::UndefinedBehaviorOpBuilder; use midenc_hir::{ - dialects::builtin::BuiltinOpBuilder, BlockRef, Builder, Felt, FieldElement, Immediate, PointerType, Type::{self, *}, ValueRef, + dialects::builtin::BuiltinOpBuilder, }; use midenc_session::diagnostics::{DiagnosticsHandler, IntoDiagnostic, Report, SourceSpan}; use wasmparser::{MemArg, Operator}; @@ -31,11 +31,11 @@ use crate::{ error::WasmResult, intrinsics::convert_intrinsics_call, module::{ + Module, func_translation_state::{ControlStackFrame, ElseData, FuncTranslationState}, function_builder_ext::FunctionBuilderExt, module_translation_state::ModuleTranslationState, types::{BlockType, FuncIndex, GlobalIndex, ModuleTypesBuilder}, - Module, }, ssa::Variable, unsupported_diag, diff --git a/frontend/wasm/src/code_translator/tests.rs b/frontend/wasm/src/code_translator/tests.rs index c24e006c1..9d91acfbf 100644 --- a/frontend/wasm/src/code_translator/tests.rs +++ b/frontend/wasm/src/code_translator/tests.rs @@ -2,9 +2,9 @@ use core::fmt::Write; use std::rc::Rc; use midenc_expect_test::expect_file; -use midenc_hir::{dialects::builtin, Op, Operation, WalkResult}; +use midenc_hir::{Op, Operation, WalkResult, dialects::builtin}; -use crate::{translate, WasmTranslationConfig}; +use crate::{WasmTranslationConfig, translate}; /// Check IR generated for a Wasm op(s). /// Wrap Wasm ops in a function and check the IR generated for the entry block of that function. diff --git a/frontend/wasm/src/component/build_ir.rs b/frontend/wasm/src/component/build_ir.rs index 67704d841..0c940de44 100644 --- a/frontend/wasm/src/component/build_ir.rs +++ b/frontend/wasm/src/component/build_ir.rs @@ -1,12 +1,12 @@ use std::rc::Rc; -use midenc_hir::{dialects::builtin::BuiltinDialect, Context}; -use midenc_session::{diagnostics::Report, Session}; +use midenc_hir::{Context, dialects::builtin::BuiltinDialect}; +use midenc_session::{Session, diagnostics::Report}; -use super::{translator::ComponentTranslator, ComponentTypesBuilder, ParsedRootComponent}; +use super::{ComponentTypesBuilder, ParsedRootComponent, translator::ComponentTranslator}; use crate::{ - component::ComponentParser, error::WasmResult, supported_component_model_features, - FrontendOutput, WasmTranslationConfig, + FrontendOutput, WasmTranslationConfig, component::ComponentParser, error::WasmResult, + supported_component_model_features, }; fn parse<'data>( diff --git a/frontend/wasm/src/component/canon_abi_utils.rs b/frontend/wasm/src/component/canon_abi_utils.rs index 4cde87b35..02fc15ccf 100644 --- a/frontend/wasm/src/component/canon_abi_utils.rs +++ b/frontend/wasm/src/component/canon_abi_utils.rs @@ -2,7 +2,7 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{AddressSpace, Builder, PointerType, SmallVec, SourceSpan, Type, ValueRef}; -use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt, WasmError}; +use crate::{WasmError, error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; /// Recursively loads primitive values from memory based on the component-level type following the /// canonical ABI loading algorithm from diff --git a/frontend/wasm/src/component/flat.rs b/frontend/wasm/src/component/flat.rs index e4af415e5..e3a756dd8 100644 --- a/frontend/wasm/src/component/flat.rs +++ b/frontend/wasm/src/component/flat.rs @@ -5,9 +5,9 @@ //! for the Wasm CM <-> core Wasm types conversion rules. use midenc_hir::{ - diagnostics::{miette, Diagnostic}, AbiParam, ArgumentExtension, ArgumentPurpose, CallConv, FunctionType, PointerType, Signature, StructType, Type, Visibility, + diagnostics::{Diagnostic, miette}, }; #[derive(Debug, thiserror::Error, Diagnostic)] diff --git a/frontend/wasm/src/component/lift_exports.rs b/frontend/wasm/src/component/lift_exports.rs index fdfe20c70..42a7641fa 100644 --- a/frontend/wasm/src/component/lift_exports.rs +++ b/frontend/wasm/src/component/lift_exports.rs @@ -4,11 +4,11 @@ use core::cell::RefCell; use midenc_dialect_cf::ControlFlowOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - dialects::builtin::{BuiltinOpBuilder, ComponentBuilder, ModuleBuilder}, CallConv, FunctionType, Ident, Op, Signature, SmallVec, SourceSpan, SymbolPath, ValueRange, ValueRef, Visibility, + dialects::builtin::{BuiltinOpBuilder, ComponentBuilder, ModuleBuilder}, }; -use midenc_session::{diagnostics::Severity, DiagnosticsHandler}; +use midenc_session::{DiagnosticsHandler, diagnostics::Severity}; use super::{ canon_abi_utils::load, diff --git a/frontend/wasm/src/component/lower_imports.rs b/frontend/wasm/src/component/lower_imports.rs index 1433d186a..5f6801238 100644 --- a/frontend/wasm/src/component/lower_imports.rs +++ b/frontend/wasm/src/component/lower_imports.rs @@ -6,12 +6,12 @@ use core::cell::RefCell; use midenc_dialect_cf::ControlFlowOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ + ArgumentPurpose, AsValueRange, CallConv, FunctionType, Op, Signature, SourceSpan, SymbolPath, + ValueRef, diagnostics::WrapErr, dialects::builtin::{ BuiltinOpBuilder, ComponentBuilder, ComponentId, ModuleBuilder, WorldBuilder, }, - ArgumentPurpose, AsValueRange, CallConv, FunctionType, Op, Signature, SourceSpan, SymbolPath, - ValueRef, }; use super::{ diff --git a/frontend/wasm/src/component/parser.rs b/frontend/wasm/src/component/parser.rs index d2e039761..9d85cde2a 100644 --- a/frontend/wasm/src/component/parser.rs +++ b/frontend/wasm/src/component/parser.rs @@ -8,26 +8,27 @@ use std::mem; use cranelift_entity::PrimaryMap; use indexmap::IndexMap; use midenc_hir::{FxBuildHasher, FxHashMap}; -use midenc_session::{diagnostics::IntoDiagnostic, Session}; +use midenc_session::{Session, diagnostics::IntoDiagnostic}; use wasmparser::{ + Chunk, ComponentImportName, Encoding, Parser, Payload, Validator, component_types::{ AliasableResourceId, ComponentEntityType, ComponentFuncTypeId, ComponentInstanceTypeId, }, types::Types, - Chunk, ComponentImportName, Encoding, Parser, Payload, Validator, }; use crate::{ + WasmTranslationConfig, component::*, error::WasmResult, module::{ module_env::{ModuleEnvironment, ParsedModule}, types::{ - convert_func_type, convert_valtype, EntityIndex, FuncIndex, GlobalIndex, MemoryIndex, - TableIndex, WasmType, + EntityIndex, FuncIndex, GlobalIndex, MemoryIndex, TableIndex, WasmType, + convert_func_type, convert_valtype, }, }, - unsupported_diag, WasmTranslationConfig, + unsupported_diag, }; /// Structure used to parse a Wasm component diff --git a/frontend/wasm/src/component/shim_bypass.rs b/frontend/wasm/src/component/shim_bypass.rs index 16b5825c5..8d890e743 100644 --- a/frontend/wasm/src/component/shim_bypass.rs +++ b/frontend/wasm/src/component/shim_bypass.rs @@ -1,4 +1,4 @@ -use midenc_hir::{formatter::DisplayValues, FxHashMap}; +use midenc_hir::{FxHashMap, formatter::DisplayValues}; use crate::module::module_env::ParsedModule; diff --git a/frontend/wasm/src/component/types/mod.rs b/frontend/wasm/src/component/types/mod.rs index 561e01955..3d5371c54 100644 --- a/frontend/wasm/src/component/types/mod.rs +++ b/frontend/wasm/src/component/types/mod.rs @@ -9,7 +9,7 @@ pub mod resources; use alloc::sync::Arc; use core::{hash::Hash, ops::Index}; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use cranelift_entity::{EntityRef, PrimaryMap}; use indexmap::IndexMap; use midenc_hir::{FxHashMap, SmallVec}; @@ -24,8 +24,8 @@ use self::resources::ResourcesBuilder; use crate::{ indices, module::types::{ - convert_func_type, convert_global_type, convert_table_type, EntityType, ModuleTypes, - ModuleTypesBuilder, + EntityType, ModuleTypes, ModuleTypesBuilder, convert_func_type, convert_global_type, + convert_table_type, }, translation_utils::{DiscriminantSize, FlagsSize}, }; @@ -1094,11 +1094,7 @@ const fn align_to(a: u32, b: u32) -> u32 { } const fn max(a: u32, b: u32) -> u32 { - if a > b { - a - } else { - b - } + if a > b { a } else { b } } impl CanonicalAbiInfo { @@ -1252,11 +1248,7 @@ impl CanonicalAbiInfo { /// doesn't exceed the `max` specified. pub fn flat_count(&self, max: usize) -> Option { let flat = usize::from(self.flat_count?); - if flat > max { - None - } else { - Some(flat) - } + if flat > max { None } else { Some(flat) } } } @@ -1446,11 +1438,7 @@ const fn add_flat(a: Option, b: Option) -> Option { }, _ => return None, }; - if sum > MAX { - None - } else { - Some(sum) - } + if sum > MAX { None } else { Some(sum) } } const fn max_flat(a: Option, b: Option) -> Option { diff --git a/frontend/wasm/src/error.rs b/frontend/wasm/src/error.rs index 803814c73..c87bec066 100644 --- a/frontend/wasm/src/error.rs +++ b/frontend/wasm/src/error.rs @@ -1,4 +1,4 @@ -use midenc_session::diagnostics::{miette, Diagnostic, Report}; +use midenc_session::diagnostics::{Diagnostic, Report, miette}; use thiserror::Error; /// A WebAssembly translation error. diff --git a/frontend/wasm/src/intrinsics/advice.rs b/frontend/wasm/src/intrinsics/advice.rs index ce0950ffd..a6e398208 100644 --- a/frontend/wasm/src/intrinsics/advice.rs +++ b/frontend/wasm/src/intrinsics/advice.rs @@ -1,8 +1,8 @@ use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - dialects::builtin::FunctionRef, - interner::{symbols, Symbol}, Builder, FunctionType, SmallVec, SourceSpan, SymbolNameComponent, Type, ValueRef, + dialects::builtin::FunctionRef, + interner::{Symbol, symbols}, }; use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; diff --git a/frontend/wasm/src/intrinsics/crypto.rs b/frontend/wasm/src/intrinsics/crypto.rs index 1486a2f33..7ca4a8869 100644 --- a/frontend/wasm/src/intrinsics/crypto.rs +++ b/frontend/wasm/src/intrinsics/crypto.rs @@ -5,9 +5,9 @@ use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - dialects::builtin::FunctionRef, - interner::{symbols, Symbol}, Builder, SmallVec, SourceSpan, SymbolNameComponent, ValueRef, + dialects::builtin::FunctionRef, + interner::{Symbol, symbols}, }; use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; diff --git a/frontend/wasm/src/intrinsics/debug.rs b/frontend/wasm/src/intrinsics/debug.rs index e49e7220b..a75a0c00f 100644 --- a/frontend/wasm/src/intrinsics/debug.rs +++ b/frontend/wasm/src/intrinsics/debug.rs @@ -1,8 +1,9 @@ use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ + Builder, SmallVec, SourceSpan, SymbolNameComponent, ValueRef, dialects::builtin::FunctionRef, - interner::{symbols, Symbol}, - smallvec, Builder, SmallVec, SourceSpan, SymbolNameComponent, ValueRef, + interner::{Symbol, symbols}, + smallvec, }; use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; diff --git a/frontend/wasm/src/intrinsics/felt.rs b/frontend/wasm/src/intrinsics/felt.rs index 858a970ea..87e262a4e 100644 --- a/frontend/wasm/src/intrinsics/felt.rs +++ b/frontend/wasm/src/intrinsics/felt.rs @@ -1,9 +1,10 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ + Builder, SmallVec, SourceSpan, SymbolNameComponent, Type, ValueRef, dialects::builtin::FunctionRef, - interner::{symbols, Symbol}, - smallvec, Builder, SmallVec, SourceSpan, SymbolNameComponent, Type, ValueRef, + interner::{Symbol, symbols}, + smallvec, }; use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; diff --git a/frontend/wasm/src/intrinsics/intrinsic.rs b/frontend/wasm/src/intrinsics/intrinsic.rs index 364c475fa..3ebf4f75b 100644 --- a/frontend/wasm/src/intrinsics/intrinsic.rs +++ b/frontend/wasm/src/intrinsics/intrinsic.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - diagnostics::{miette, Diagnostic}, - interner::{symbols, Symbol}, FunctionType, SymbolNameComponent, SymbolPath, Type, + diagnostics::{Diagnostic, miette}, + interner::{Symbol, symbols}, }; use super::{advice, crypto, debug, felt, mem}; diff --git a/frontend/wasm/src/intrinsics/mem.rs b/frontend/wasm/src/intrinsics/mem.rs index 97d081447..4600a5d56 100644 --- a/frontend/wasm/src/intrinsics/mem.rs +++ b/frontend/wasm/src/intrinsics/mem.rs @@ -1,9 +1,9 @@ use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - dialects::builtin::FunctionRef, - interner::{symbols, Symbol}, AbiParam, Builder, CallConv, FunctionType, Signature, SmallVec, SourceSpan, SymbolNameComponent, Type, ValueRef, + dialects::builtin::FunctionRef, + interner::{Symbol, symbols}, }; use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; diff --git a/frontend/wasm/src/intrinsics/mod.rs b/frontend/wasm/src/intrinsics/mod.rs index ce8e6bf10..307501cf8 100644 --- a/frontend/wasm/src/intrinsics/mod.rs +++ b/frontend/wasm/src/intrinsics/mod.rs @@ -8,7 +8,7 @@ pub mod debug; pub mod felt; pub mod mem; -use midenc_hir::{dialects::builtin::FunctionRef, Builder, SmallVec, SourceSpan, ValueRef}; +use midenc_hir::{Builder, SmallVec, SourceSpan, ValueRef, dialects::builtin::FunctionRef}; use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; diff --git a/frontend/wasm/src/lib.rs b/frontend/wasm/src/lib.rs index 9cae525cf..b7eb35aa4 100644 --- a/frontend/wasm/src/lib.rs +++ b/frontend/wasm/src/lib.rs @@ -25,7 +25,7 @@ use alloc::rc::Rc; use component::build_ir::translate_component; use error::WasmResult; -use midenc_hir::{dialects::builtin, Context}; +use midenc_hir::{Context, dialects::builtin}; use module::build_ir::translate_module_as_component; use wasmparser::WasmFeatures; diff --git a/frontend/wasm/src/miden_abi/mod.rs b/frontend/wasm/src/miden_abi/mod.rs index d99329c86..7f84b44ed 100644 --- a/frontend/wasm/src/miden_abi/mod.rs +++ b/frontend/wasm/src/miden_abi/mod.rs @@ -2,7 +2,7 @@ pub(crate) mod stdlib; pub(crate) mod transform; pub(crate) mod tx_kernel; -use midenc_hir::{interner::Symbol, FunctionType, FxHashMap, SymbolNameComponent, SymbolPath}; +use midenc_hir::{FunctionType, FxHashMap, SymbolNameComponent, SymbolPath, interner::Symbol}; use midenc_hir_symbol::symbols; pub(crate) type FunctionTypeMap = FxHashMap; diff --git a/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs b/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs index b4eca5bd8..3ae457e14 100644 --- a/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs +++ b/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; 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 24e901668..97d4fc455 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 @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; 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 588d322d7..e5dacc283 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/blake3.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/blake3.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo.rs index 5e636b30d..8701fdcfe 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::{Felt, I32}, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; 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 d84bc2bc7..77534c255 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; diff --git a/frontend/wasm/src/miden_abi/stdlib/mem.rs b/frontend/wasm/src/miden_abi/stdlib/mem.rs index b3aafacfd..05630983d 100644 --- a/frontend/wasm/src/miden_abi/stdlib/mem.rs +++ b/frontend/wasm/src/miden_abi/stdlib/mem.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; diff --git a/frontend/wasm/src/miden_abi/transform.rs b/frontend/wasm/src/miden_abi/transform.rs index 1b45aecd4..4f3f83cca 100644 --- a/frontend/wasm/src/miden_abi/transform.rs +++ b/frontend/wasm/src/miden_abi/transform.rs @@ -1,8 +1,8 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - dialects::builtin::FunctionRef, interner::symbols, Builder, Immediate, PointerType, - SymbolNameComponent, SymbolPath, Type, ValueRef, + Builder, Immediate, PointerType, SymbolNameComponent, SymbolPath, Type, ValueRef, + dialects::builtin::FunctionRef, interner::symbols, }; use super::{stdlib, tx_kernel}; 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 debbc2f02..fa2dcf01a 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; 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 e3bdd06fe..800b20957 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; diff --git a/frontend/wasm/src/miden_abi/tx_kernel/asset.rs b/frontend/wasm/src/miden_abi/tx_kernel/asset.rs index 1159a4edd..b541098af 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/asset.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/asset.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; diff --git a/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs b/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs index ef2633ddc..3e1f31e35 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; 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 4b85af7eb..9ca66b5dd 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; 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 b4ed8b985..91f0f070d 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; 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 77f0d6639..fb1dbee48 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; diff --git a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs index 6ce07d6e0..f89275378 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs @@ -1,7 +1,7 @@ use midenc_hir::{ - interner::{symbols, Symbol}, CallConv, FunctionType, SymbolNameComponent, SymbolPath, Type::*, + interner::{Symbol, symbols}, }; use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; diff --git a/frontend/wasm/src/module/func_translator.rs b/frontend/wasm/src/module/func_translator.rs index 65d713613..4dbb32b98 100644 --- a/frontend/wasm/src/module/func_translator.rs +++ b/frontend/wasm/src/module/func_translator.rs @@ -10,13 +10,13 @@ use std::{cell::RefCell, rc::Rc}; use cranelift_entity::EntityRef; use midenc_hir::{ + BlockRef, Builder, Context, Op, diagnostics::{ColumnNumber, LineNumber}, dialects::builtin::{BuiltinOpBuilder, FunctionRef}, - BlockRef, Builder, Context, Op, }; use midenc_session::{ - diagnostics::{DiagnosticsHandler, IntoDiagnostic, SourceManagerExt, SourceSpan}, Session, + diagnostics::{DiagnosticsHandler, IntoDiagnostic, SourceManagerExt, SourceSpan}, }; use wasmparser::{FuncValidator, FunctionBody, WasmModuleResources}; diff --git a/frontend/wasm/src/module/function_builder_ext.rs b/frontend/wasm/src/module/function_builder_ext.rs index a45311443..643e66ba8 100644 --- a/frontend/wasm/src/module/function_builder_ext.rs +++ b/frontend/wasm/src/module/function_builder_ext.rs @@ -7,11 +7,11 @@ use midenc_dialect_cf::ControlFlowOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_dialect_ub::UndefinedBehaviorOpBuilder; use midenc_hir::{ - dialects::builtin::{BuiltinOpBuilder, FunctionBuilder, FunctionRef}, - traits::{BranchOpInterface, Terminator}, BlockRef, Builder, Context, EntityRef, FxHashMap, FxHashSet, Ident, Listener, ListenerType, OpBuilder, OperationRef, ProgramPoint, RegionRef, Signature, SmallVec, SourceSpan, Type, ValueRef, + dialects::builtin::{BuiltinOpBuilder, FunctionBuilder, FunctionRef}, + traits::{BranchOpInterface, Terminator}, }; use crate::ssa::{SSABuilder, SideEffects, Variable}; diff --git a/frontend/wasm/src/module/linker_stubs.rs b/frontend/wasm/src/module/linker_stubs.rs index 483f13d48..4833a89a1 100644 --- a/frontend/wasm/src/module/linker_stubs.rs +++ b/frontend/wasm/src/module/linker_stubs.rs @@ -9,15 +9,15 @@ use std::cell::RefCell; use midenc_dialect_cf::ControlFlowOpBuilder; use midenc_hir::{ + AbiParam, FunctionType, Op, Signature, SmallVec, SymbolPath, ValueRef, diagnostics::WrapErr, dialects::builtin::{BuiltinOpBuilder, FunctionRef, ModuleBuilder}, - AbiParam, FunctionType, Op, Signature, SmallVec, SymbolPath, ValueRef, }; use wasmparser::{FunctionBody, Operator}; use crate::{ error::WasmResult, - intrinsics::{convert_intrinsics_call, Intrinsic}, + intrinsics::{Intrinsic, convert_intrinsics_call}, miden_abi::{ is_miden_abi_module, miden_abi_function_type, transform::transform_miden_abi_call, }, diff --git a/frontend/wasm/src/module/mod.rs b/frontend/wasm/src/module/mod.rs index c0c73f209..d874e82de 100644 --- a/frontend/wasm/src/module/mod.rs +++ b/frontend/wasm/src/module/mod.rs @@ -3,9 +3,9 @@ use alloc::{borrow::Cow, collections::BTreeMap}; use core::{fmt, ops::Range}; -use cranelift_entity::{packed_option::ReservedValue, EntityRef, PrimaryMap}; +use cranelift_entity::{EntityRef, PrimaryMap, packed_option::ReservedValue}; use indexmap::IndexMap; -use midenc_hir::{interner::Symbol, FxHashMap, Ident}; +use midenc_hir::{FxHashMap, Ident, interner::Symbol}; use midenc_session::DiagnosticsHandler; use self::types::*; diff --git a/frontend/wasm/src/module/module_env.rs b/frontend/wasm/src/module/module_env.rs index 7a598ade4..cd22b54aa 100644 --- a/frontend/wasm/src/module/module_env.rs +++ b/frontend/wasm/src/module/module_env.rs @@ -2,32 +2,32 @@ use alloc::sync::Arc; use core::ops::Range; use std::path::PathBuf; -use cranelift_entity::{packed_option::ReservedValue, PrimaryMap}; -use midenc_hir::{interner::Symbol, Ident}; +use cranelift_entity::{PrimaryMap, packed_option::ReservedValue}; +use midenc_hir::{Ident, interner::Symbol}; use midenc_session::diagnostics::{DiagnosticsHandler, IntoDiagnostic, Report, Severity}; use wasmparser::{ - types::CoreTypeId, CustomSectionReader, DataKind, ElementItems, ElementKind, Encoding, - ExternalKind, FuncToValidate, FunctionBody, NameSectionReader, Naming, Operator, Parser, - Payload, TypeRef, Validator, ValidatorResources, + CustomSectionReader, DataKind, ElementItems, ElementKind, Encoding, ExternalKind, + FuncToValidate, FunctionBody, NameSectionReader, Naming, Operator, Parser, Payload, TypeRef, + Validator, ValidatorResources, types::CoreTypeId, }; use super::{ - types::{DataSegment, DataSegmentIndex}, ModuleImport, TableInitialValue, + types::{DataSegment, DataSegmentIndex}, }; use crate::{ + WasmTranslationConfig, component::SignatureIndex, error::WasmResult, module::{ + FuncRefIndex, Module, ModuleType, TableSegment, types::{ - convert_func_type, convert_global_type, convert_table_type, convert_valtype, DataSegmentOffset, DefinedFuncIndex, ElemIndex, EntityIndex, EntityType, FuncIndex, GlobalIndex, GlobalInit, MemoryIndex, ModuleTypesBuilder, TableIndex, TypeIndex, - WasmType, + WasmType, convert_func_type, convert_global_type, convert_table_type, convert_valtype, }, - FuncRefIndex, Module, ModuleType, TableSegment, }, - unsupported_diag, WasmTranslationConfig, + unsupported_diag, }; /// Object containing the standalone environment information. diff --git a/frontend/wasm/src/module/module_translation_state.rs b/frontend/wasm/src/module/module_translation_state.rs index 473980186..31f6ce9e0 100644 --- a/frontend/wasm/src/module/module_translation_state.rs +++ b/frontend/wasm/src/module/module_translation_state.rs @@ -1,11 +1,12 @@ use midenc_hir::{ + CallConv, FxHashMap, Signature, SymbolNameComponent, SymbolPath, Visibility, dialects::builtin::{ModuleBuilder, WorldBuilder}, interner::Symbol, - smallvec, CallConv, FxHashMap, Signature, SymbolNameComponent, SymbolPath, Visibility, + smallvec, }; use midenc_session::diagnostics::{DiagnosticsHandler, Severity}; -use super::{instance::ModuleArgument, ir_func_type, types::ModuleTypesBuilder, FuncIndex, Module}; +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, diff --git a/frontend/wasm/src/ssa.rs b/frontend/wasm/src/ssa.rs index 4289f67ce..b3a0f7f8b 100644 --- a/frontend/wasm/src/ssa.rs +++ b/frontend/wasm/src/ssa.rs @@ -12,10 +12,10 @@ use alloc::rc::Rc; use core::mem; -use cranelift_entity::{entity_impl, EntityList, ListPool}; +use cranelift_entity::{EntityList, ListPool, entity_impl}; use midenc_hir::{ - traits::BranchOpInterface, BlockRef, Context, FxHashMap, FxHashSet, OperationRef, SourceSpan, - Type, ValueRef, + BlockRef, Context, FxHashMap, FxHashSet, OperationRef, SourceSpan, Type, ValueRef, + traits::BranchOpInterface, }; /// Structure containing the data relevant the construction of SSA for a given function. diff --git a/hir-analysis/src/analyses/constant_propagation.rs b/hir-analysis/src/analyses/constant_propagation.rs index c1f2cffaf..ebd3ac2e4 100644 --- a/hir-analysis/src/analyses/constant_propagation.rs +++ b/hir-analysis/src/analyses/constant_propagation.rs @@ -2,14 +2,14 @@ use alloc::{boxed::Box, rc::Rc}; use core::fmt; use midenc_hir::{ - traits::Foldable, AttributeValue, Dialect, FoldResult, Forward, OpFoldResult, Operation, - Report, SmallVec, + AttributeValue, Dialect, FoldResult, Forward, OpFoldResult, Operation, Report, SmallVec, + traits::Foldable, }; use crate::{ - sparse::{self, SparseDataFlowAnalysis}, AnalysisState, AnalysisStateGuard, AnalysisStateGuardMut, BuildableDataFlowAnalysis, DataFlowSolver, Lattice, LatticeLike, SparseForwardDataFlowAnalysis, SparseLattice, + sparse::{self, SparseDataFlowAnalysis}, }; /// This lattice value represents a known constant value of a lattice. diff --git a/hir-analysis/src/analyses/dce.rs b/hir-analysis/src/analyses/dce.rs index 361023de1..8a5b627e1 100644 --- a/hir-analysis/src/analyses/dce.rs +++ b/hir-analysis/src/analyses/dce.rs @@ -7,13 +7,13 @@ use core::{ }; use midenc_hir::{ - adt::{SmallDenseMap, SmallSet}, - pass::AnalysisManager, - traits::{BranchOpInterface, ReturnLike}, AttributeValue, Block, BlockRef, CallOpInterface, CallableOpInterface, EntityWithId, Forward, Operation, OperationRef, ProgramPoint, RegionBranchOpInterface, RegionBranchPoint, RegionBranchTerminatorOpInterface, RegionSuccessorIter, Report, SmallVec, SourceSpan, Spanned, Symbol, SymbolManager, SymbolMap, SymbolTable, ValueRef, + adt::{SmallDenseMap, SmallSet}, + pass::AnalysisManager, + traits::{BranchOpInterface, ReturnLike}, }; use super::constant_propagation::ConstantValue; diff --git a/hir-analysis/src/analyses/liveness.rs b/hir-analysis/src/analyses/liveness.rs index 29c46c6ff..82b9c4600 100644 --- a/hir-analysis/src/analyses/liveness.rs +++ b/hir-analysis/src/analyses/liveness.rs @@ -3,19 +3,19 @@ mod next_use_set; use core::borrow::Borrow; use midenc_hir::{ - dominance::DominanceInfo, - pass::{Analysis, AnalysisManager, PreservedAnalyses}, Backward, Block, BlockRef, CallOpInterface, EntityRef, Operation, ProgramPoint, RegionBranchOpInterface, RegionBranchPoint, RegionRef, Report, Spanned, SymbolTable, ValueRef, + dominance::DominanceInfo, + pass::{Analysis, AnalysisManager, PreservedAnalyses}, }; pub use self::next_use_set::NextUseSet; -use super::{dce::Executable, DeadCodeAnalysis, SparseConstantPropagation}; +use super::{DeadCodeAnalysis, SparseConstantPropagation, dce::Executable}; use crate::{ - analyses::{dce::CfgEdge, LoopState}, - dense::DenseDataFlowAnalysis, AnalysisState, AnalysisStateGuardMut, BuildableDataFlowAnalysis, CallControlFlowAction, DataFlowSolver, DenseBackwardDataFlowAnalysis, DenseLattice, Lattice, LatticeLike, + analyses::{LoopState, dce::CfgEdge}, + dense::DenseDataFlowAnalysis, }; /// The distance penalty applied to an edge which exits a loop diff --git a/hir-analysis/src/analyses/spills/tests.rs b/hir-analysis/src/analyses/spills/tests.rs index 6385c5265..c35243ec0 100644 --- a/hir-analysis/src/analyses/spills/tests.rs +++ b/hir-analysis/src/analyses/spills/tests.rs @@ -6,15 +6,15 @@ use midenc_dialect_cf::ControlFlowOpBuilder as Cf; use midenc_dialect_hir::HirOpBuilder; use midenc_expect_test::expect_file; use midenc_hir::{ - dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder}, - pass::AnalysisManager, AbiParam, AddressSpace, BlockRef, Builder, Context, Ident, Op, OpBuilder, PointerType, ProgramPoint, Report, Signature, SourceSpan, SymbolTable, Type, ValueRef, + dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder}, + pass::AnalysisManager, }; use crate::analyses::{ - spills::{Predecessor, Split}, SpillAnalysis, + spills::{Predecessor, Split}, }; type AnalysisResult = Result; diff --git a/hir-analysis/src/analysis.rs b/hir-analysis/src/analysis.rs index 74ca159d1..856e9d5d7 100644 --- a/hir-analysis/src/analysis.rs +++ b/hir-analysis/src/analysis.rs @@ -1,6 +1,6 @@ pub(super) mod state; -use midenc_hir::{pass::AnalysisManager, Direction, Operation, ProgramPoint, Report}; +use midenc_hir::{Direction, Operation, ProgramPoint, Report, pass::AnalysisManager}; pub use self::state::{ AnalysisState, AnalysisStateGuard, AnalysisStateGuardMut, AnalysisStateInfo, diff --git a/hir-analysis/src/analysis/state/info.rs b/hir-analysis/src/analysis/state/info.rs index e98aa3065..a4d028c34 100644 --- a/hir-analysis/src/analysis/state/info.rs +++ b/hir-analysis/src/analysis/state/info.rs @@ -5,10 +5,10 @@ use core::{ ptr::NonNull, }; -use midenc_hir::{adt::SmallSet, entity::RawEntity, EntityRef, SmallVec}; +use midenc_hir::{EntityRef, SmallVec, adt::SmallSet, entity::RawEntity}; use super::*; -use crate::{solver::QueuedAnalysis, AnalysisQueue, LatticeAnchor, LatticeAnchorRef}; +use crate::{AnalysisQueue, LatticeAnchor, LatticeAnchorRef, solver::QueuedAnalysis}; pub type Revision = u32; diff --git a/hir-analysis/src/dense.rs b/hir-analysis/src/dense.rs index 05637564b..353bf6f47 100644 --- a/hir-analysis/src/dense.rs +++ b/hir-analysis/src/dense.rs @@ -3,9 +3,9 @@ mod forward; mod lattice; use midenc_hir::{ - cfg::Graph, dominance::DominanceInfo, loops::LoopForest, pass::AnalysisManager, Backward, - Block, BlockRef, CallOpInterface, EntityWithId, Forward, Operation, ProgramPoint, + Backward, Block, BlockRef, CallOpInterface, EntityWithId, Forward, Operation, ProgramPoint, RegionBranchOpInterface, RegionKindInterface, RegionRef, Report, Spanned, SymbolTable, + cfg::Graph, dominance::DominanceInfo, loops::LoopForest, pass::AnalysisManager, }; pub use self::{ @@ -13,7 +13,7 @@ pub use self::{ lattice::DenseLattice, }; use super::{AnalysisStrategy, DataFlowAnalysis, DataFlowSolver, Dense}; -use crate::analyses::{dce::CfgEdge, LoopAction, LoopState}; +use crate::analyses::{LoopAction, LoopState, dce::CfgEdge}; /// This type provides an [AnalysisStrategy] for dense data-flow analyses. /// diff --git a/hir-analysis/src/dense/backward.rs b/hir-analysis/src/dense/backward.rs index c8771c44f..551a86cc1 100644 --- a/hir-analysis/src/dense/backward.rs +++ b/hir-analysis/src/dense/backward.rs @@ -1,13 +1,13 @@ use midenc_hir::{ - cfg::Graph, Block, CallOpInterface, CallableOpInterface, Operation, ProgramPoint, - RegionBranchOpInterface, RegionBranchPoint, RegionBranchTerminatorOpInterface, RegionRef, - Report, Spanned, SymbolTable, + Block, CallOpInterface, CallableOpInterface, Operation, ProgramPoint, RegionBranchOpInterface, + RegionBranchPoint, RegionBranchTerminatorOpInterface, RegionRef, Report, Spanned, SymbolTable, + cfg::Graph, }; use super::*; use crate::{ - analyses::dce::{CfgEdge, Executable, PredecessorState}, AnalysisStateGuardMut, BuildableAnalysisState, CallControlFlowAction, DataFlowSolver, + analyses::dce::{CfgEdge, Executable, PredecessorState}, }; /// The base trait for all dense backward data-flow analyses. diff --git a/hir-analysis/src/dense/forward.rs b/hir-analysis/src/dense/forward.rs index 5f2fa9d58..812eac75b 100644 --- a/hir-analysis/src/dense/forward.rs +++ b/hir-analysis/src/dense/forward.rs @@ -5,8 +5,8 @@ use midenc_hir::{ use super::*; use crate::{ - analyses::dce::{CfgEdge, Executable, PredecessorState}, AnalysisStateGuardMut, BuildableAnalysisState, CallControlFlowAction, DataFlowSolver, + analyses::dce::{CfgEdge, Executable, PredecessorState}, }; /// The base trait for all dense forward data-flow analyses. diff --git a/hir-analysis/src/solver.rs b/hir-analysis/src/solver.rs index d6fdcf357..b498f38bc 100644 --- a/hir-analysis/src/solver.rs +++ b/hir-analysis/src/solver.rs @@ -4,8 +4,8 @@ use alloc::{collections::VecDeque, rc::Rc}; use core::{any::TypeId, cell::RefCell, ptr::NonNull}; use midenc_hir::{ - hashbrown, pass::AnalysisManager, EntityRef, FxHashMap, Operation, ProgramPoint, Report, - SmallVec, + EntityRef, FxHashMap, Operation, ProgramPoint, Report, SmallVec, hashbrown, + pass::AnalysisManager, }; use self::{allocator::DataFlowSolverAlloc, analysis::AnalysisStrategy}; @@ -496,8 +496,8 @@ impl DataFlowSolver { use hashbrown::hash_map::Entry; use crate::{ - analysis::state::{RawAnalysisStateInfo, RawAnalysisStateInfoHandle}, AnalysisStateSubscriptionBehavior, + analysis::state::{RawAnalysisStateInfo, RawAnalysisStateInfoHandle}, }; log::trace!(target: "dataflow-solver", "computing analysis state entry key"); diff --git a/hir-analysis/src/sparse.rs b/hir-analysis/src/sparse.rs index f5c33f3c5..8ff66cdad 100644 --- a/hir-analysis/src/sparse.rs +++ b/hir-analysis/src/sparse.rs @@ -3,13 +3,13 @@ mod forward; mod lattice; use midenc_hir::{ - pass::AnalysisManager, Backward, CallOpInterface, Forward, OpOperandImpl, Operation, - ProgramPoint, RegionSuccessor, Report, + Backward, CallOpInterface, Forward, OpOperandImpl, Operation, ProgramPoint, RegionSuccessor, + Report, pass::AnalysisManager, }; pub use self::{ - backward::{set_all_to_exit_states, SparseBackwardDataFlowAnalysis}, - forward::{set_all_to_entry_states, SparseForwardDataFlowAnalysis}, + backward::{SparseBackwardDataFlowAnalysis, set_all_to_exit_states}, + forward::{SparseForwardDataFlowAnalysis, set_all_to_entry_states}, lattice::SparseLattice, }; use super::{AnalysisStrategy, DataFlowAnalysis, DataFlowSolver, Sparse}; diff --git a/hir-analysis/src/sparse/backward.rs b/hir-analysis/src/sparse/backward.rs index 5007c7ba9..6c7cf28fa 100644 --- a/hir-analysis/src/sparse/backward.rs +++ b/hir-analysis/src/sparse/backward.rs @@ -2,17 +2,17 @@ use alloc::boxed::Box; use bitvec::bitvec; use midenc_hir::{ - traits::{BranchOpInterface, ReturnLike}, AttributeValue, Backward, CallOpInterface, CallableOpInterface, EntityWithId, OpOperandImpl, OpOperandRange, OpResultRange, Operation, OperationRef, ProgramPoint, RegionBranchOpInterface, RegionBranchTerminatorOpInterface, RegionSuccessorIter, Report, SmallVec, StorableEntity, SuccessorOperands, ValueRef, + traits::{BranchOpInterface, ReturnLike}, }; use super::{SparseDataFlowAnalysis, SparseLattice}; use crate::{ - analyses::dce::{Executable, PredecessorState}, AnalysisStateGuard, AnalysisStateGuardMut, BuildableAnalysisState, DataFlowSolver, + analyses::dce::{Executable, PredecessorState}, }; /// A sparse (backward) data-flow analysis for propagating SSA value lattices backwards across the diff --git a/hir-analysis/src/sparse/forward.rs b/hir-analysis/src/sparse/forward.rs index fb1701c01..ade2ed582 100644 --- a/hir-analysis/src/sparse/forward.rs +++ b/hir-analysis/src/sparse/forward.rs @@ -1,16 +1,16 @@ use midenc_hir::{ - formatter::DisplayValues, traits::BranchOpInterface, Block, BlockArgument, BlockArgumentRange, - CallOpInterface, CallableOpInterface, EntityWithId, Forward, OpOperandRange, OpResult, - OpResultRange, Operation, ProgramPoint, RegionBranchOpInterface, RegionBranchPoint, - RegionBranchTerminatorOpInterface, RegionSuccessor, Report, SmallVec, Spanned, StorableEntity, - SuccessorOperands, ValueRef, + Block, BlockArgument, BlockArgumentRange, CallOpInterface, CallableOpInterface, EntityWithId, + Forward, OpOperandRange, OpResult, OpResultRange, Operation, ProgramPoint, + RegionBranchOpInterface, RegionBranchPoint, RegionBranchTerminatorOpInterface, RegionSuccessor, + Report, SmallVec, Spanned, StorableEntity, SuccessorOperands, ValueRef, + formatter::DisplayValues, traits::BranchOpInterface, }; use super::{SparseDataFlowAnalysis, SparseLattice}; use crate::{ - analyses::dce::{CfgEdge, Executable, PredecessorState}, AnalysisState, AnalysisStateGuard, AnalysisStateGuardMut, BuildableAnalysisState, DataFlowSolver, + analyses::dce::{CfgEdge, Executable, PredecessorState}, }; /// The base trait for sparse forward data-flow analyses. diff --git a/hir-macros/src/spanned.rs b/hir-macros/src/spanned.rs index e88a6fced..4c15d4ce9 100644 --- a/hir-macros/src/spanned.rs +++ b/hir-macros/src/spanned.rs @@ -2,9 +2,9 @@ use proc_macro::TokenStream; use proc_macro2::Span; use quote::quote; use syn::{ - punctuated::Punctuated, spanned::Spanned, Arm, Attribute, Error, Expr, ExprField, ExprMatch, - ExprMethodCall, ExprPath, ExprUnary, FieldPat, Ident, Index, Member, Pat, PatIdent, PatRest, - PatStruct, PatTupleStruct, PatWild, Path, PathArguments, PathSegment, Token, UnOp, + Arm, Attribute, Error, Expr, ExprField, ExprMatch, ExprMethodCall, ExprPath, ExprUnary, + FieldPat, Ident, Index, Member, Pat, PatIdent, PatRest, PatStruct, PatTupleStruct, PatWild, + Path, PathArguments, PathSegment, Token, UnOp, punctuated::Punctuated, spanned::Spanned, }; pub fn derive_spanned_struct( diff --git a/hir-symbol/build.rs b/hir-symbol/build.rs index 5c716dacc..e2a36746e 100644 --- a/hir-symbol/build.rs +++ b/hir-symbol/build.rs @@ -13,7 +13,7 @@ use std::{ }; use inflector::Inflector; -use toml::{value::Table, Value}; +use toml::{Value, value::Table}; type FxHashSet = hashbrown::HashSet; diff --git a/hir-transform/src/canonicalization.rs b/hir-transform/src/canonicalization.rs index 095979a40..ad57b0f97 100644 --- a/hir-transform/src/canonicalization.rs +++ b/hir-transform/src/canonicalization.rs @@ -1,9 +1,9 @@ use alloc::{boxed::Box, format, rc::Rc}; use midenc_hir::{ + Context, EntityMut, Operation, OperationName, Report, Spanned, pass::{OperationPass, Pass, PassExecutionState, PostPassStatus}, patterns::{self, FrozenRewritePatternSet, GreedyRewriteConfig, RewritePatternSet}, - Context, EntityMut, Operation, OperationName, Report, Spanned, }; use midenc_session::diagnostics::Severity; diff --git a/hir-transform/src/cfg_to_scf.rs b/hir-transform/src/cfg_to_scf.rs index d8ebb5f22..11457baa0 100644 --- a/hir-transform/src/cfg_to_scf.rs +++ b/hir-transform/src/cfg_to_scf.rs @@ -108,9 +108,9 @@ mod edges; mod transform; use midenc_hir::{ - adt::SmallSet, dominance::DominanceInfo, traits::BranchOpInterface, BlockRef, Builder, - OpBuilder, Operation, OperationRef, Region, RegionRef, Report, SmallVec, SourceSpan, Type, - Value, ValueRange, ValueRef, WalkResult, + BlockRef, Builder, OpBuilder, Operation, OperationRef, Region, RegionRef, Report, SmallVec, + SourceSpan, Type, Value, ValueRange, ValueRef, WalkResult, adt::SmallSet, + dominance::DominanceInfo, traits::BranchOpInterface, }; use self::transform::TransformationContext; diff --git a/hir-transform/src/cfg_to_scf/edges.rs b/hir-transform/src/cfg_to_scf/edges.rs index 9d93960e1..62e27151b 100644 --- a/hir-transform/src/cfg_to_scf/edges.rs +++ b/hir-transform/src/cfg_to_scf/edges.rs @@ -1,6 +1,6 @@ use midenc_hir::{ - adt::SmallDenseMap, AsValueRange, BlockRef, OpBuilder, Report, SmallVec, SourceSpan, Type, - ValueRef, + AsValueRange, BlockRef, OpBuilder, Report, SmallVec, SourceSpan, Type, ValueRef, + adt::SmallDenseMap, }; use super::*; diff --git a/hir-transform/src/cfg_to_scf/transform.rs b/hir-transform/src/cfg_to_scf/transform.rs index b639852b1..9869b83f3 100644 --- a/hir-transform/src/cfg_to_scf/transform.rs +++ b/hir-transform/src/cfg_to_scf/transform.rs @@ -1,13 +1,14 @@ use alloc::rc::Rc; use midenc_hir::{ + AsValueRange, Block, BlockRef, Builder, Context, EntityWithId, FxHashMap, OpBuilder, + OperationRef, ProgramPoint, Region, RegionRef, Report, SmallVec, SourceSpan, Spanned, Type, + Usable, Value, ValueRange, ValueRef, adt::{SmallDenseMap, SmallSet}, cfg::Graph, dominance::{DominanceInfo, PreOrderDomTreeIter}, formatter::DisplayValues, - smallvec, AsValueRange, Block, BlockRef, Builder, Context, EntityWithId, FxHashMap, OpBuilder, - OperationRef, ProgramPoint, Region, RegionRef, Report, SmallVec, SourceSpan, Spanned, Type, - Usable, Value, ValueRange, ValueRef, + smallvec, }; use super::{ @@ -1302,7 +1303,7 @@ struct ReturnLikeOpKey(OperationRef); impl Eq for ReturnLikeOpKey {} impl PartialEq for ReturnLikeOpKey { fn eq(&self, other: &Self) -> bool { - use midenc_hir::equivalence::{ignore_value_equivalence, OperationEquivalenceFlags}; + use midenc_hir::equivalence::{OperationEquivalenceFlags, ignore_value_equivalence}; let a = self.0.borrow(); a.is_equivalent_with_options( &other.0.borrow(), diff --git a/hir-transform/src/lib.rs b/hir-transform/src/lib.rs index 0e4a798d4..e869c2578 100644 --- a/hir-transform/src/lib.rs +++ b/hir-transform/src/lib.rs @@ -20,8 +20,8 @@ mod spill; //pub use self::inliner::Inliner; pub use self::{ canonicalization::Canonicalizer, - cfg_to_scf::{transform_cfg_to_scf, CFGToSCFInterface}, + cfg_to_scf::{CFGToSCFInterface, transform_cfg_to_scf}, sccp::SparseConditionalConstantPropagation, sink::{ControlFlowSink, SinkOperandDefs}, - spill::{transform_spills, ReloadLike, SpillLike, TransformSpillsInterface}, + spill::{ReloadLike, SpillLike, TransformSpillsInterface, transform_spills}, }; diff --git a/hir-transform/src/sccp.rs b/hir-transform/src/sccp.rs index a80a6e194..c779183cb 100644 --- a/hir-transform/src/sccp.rs +++ b/hir-transform/src/sccp.rs @@ -1,12 +1,12 @@ use midenc_hir::{ - pass::{Pass, PassExecutionState}, - patterns::NoopRewriterListener, BlockRef, Builder, EntityMut, OpBuilder, Operation, OperationFolder, OperationName, RegionList, Report, SmallVec, ValueRef, + pass::{Pass, PassExecutionState}, + patterns::NoopRewriterListener, }; use midenc_hir_analysis::{ - analyses::{constant_propagation::ConstantValue, DeadCodeAnalysis, SparseConstantPropagation}, DataFlowSolver, Lattice, + analyses::{DeadCodeAnalysis, SparseConstantPropagation, constant_propagation::ConstantValue}, }; /// This pass implements a general algorithm for sparse conditional constant propagation. diff --git a/hir-transform/src/sink.rs b/hir-transform/src/sink.rs index c5c97ef1f..d931786ff 100644 --- a/hir-transform/src/sink.rs +++ b/hir-transform/src/sink.rs @@ -1,14 +1,14 @@ use alloc::vec::Vec; use midenc_hir::{ + Backward, Builder, EntityMut, Forward, FxHashSet, OpBuilder, Operation, OperationName, + OperationRef, ProgramPoint, RawWalk, Region, RegionBranchOpInterface, + RegionBranchTerminatorOpInterface, RegionRef, Report, SmallVec, Usable, ValueRef, adt::SmallDenseMap, dominance::DominanceInfo, matchers::{self, Matcher}, pass::{Pass, PassExecutionState, PostPassStatus}, traits::{ConstantLike, Terminator}, - Backward, Builder, EntityMut, Forward, FxHashSet, OpBuilder, Operation, OperationName, - OperationRef, ProgramPoint, RawWalk, Region, RegionBranchOpInterface, - RegionBranchTerminatorOpInterface, RegionRef, Report, SmallVec, Usable, ValueRef, }; /// This transformation sinks operations as close as possible to their uses, one of two ways: diff --git a/hir-transform/src/spill.rs b/hir-transform/src/spill.rs index 94e3111f2..309e60c9a 100644 --- a/hir-transform/src/spill.rs +++ b/hir-transform/src/spill.rs @@ -1,18 +1,18 @@ 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, adt::{SmallDenseMap, SmallSet}, cfg::Graph, dominance::{DomTreeNode, DominanceFrontier, DominanceInfo}, pass::{AnalysisManager, PostPassStatus}, traits::SingleRegion, - BlockRef, Builder, Context, FxHashMap, OpBuilder, OpOperand, Operation, OperationRef, - ProgramPoint, Region, RegionBranchOpInterface, RegionBranchPoint, RegionRef, Report, Rewriter, - SmallVec, SourceSpan, Spanned, StorableEntity, Usable, ValueRange, ValueRef, }; use midenc_hir_analysis::analyses::{ - spills::{Placement, Predecessor}, SpillAnalysis, + spills::{Placement, Predecessor}, }; /// This interface is used in conjunction with [transform_spills] so that the transform can be used diff --git a/hir/src/adt/smalldeque.rs b/hir/src/adt/smalldeque.rs index ad0ad847b..8e8e4defa 100644 --- a/hir/src/adt/smalldeque.rs +++ b/hir/src/adt/smalldeque.rs @@ -2,7 +2,7 @@ use alloc::vec::Vec; use core::{ cmp::Ordering, fmt, - iter::{repeat_n, repeat_with, ByRefSized}, + iter::{ByRefSized, repeat_n, repeat_with}, ops::{Index, IndexMut, Range, RangeBounds}, ptr::{self, NonNull}, }; @@ -3739,7 +3739,7 @@ mod tests { impl Hasher for SimpleHasher { fn finish(&self) -> u64 { - self.0 .0 + self.0.0 } fn write(&mut self, bytes: &[u8]) { diff --git a/hir/src/attributes.rs b/hir/src/attributes.rs index 654c9dd15..230ad2c62 100644 --- a/hir/src/attributes.rs +++ b/hir/src/attributes.rs @@ -5,7 +5,7 @@ use alloc::{boxed::Box, collections::BTreeMap, vec, vec::Vec}; use core::{any::Any, borrow::Borrow, fmt}; pub use self::{overflow::Overflow, visibility::Visibility}; -use crate::{interner::Symbol, Immediate}; +use crate::{Immediate, interner::Symbol}; pub mod markers { use midenc_hir_symbol::symbols; diff --git a/hir/src/derive.rs b/hir/src/derive.rs index 714351ac0..94f7da0d6 100644 --- a/hir/src/derive.rs +++ b/hir/src/derive.rs @@ -147,10 +147,10 @@ mod tests { use midenc_session::diagnostics::Severity; use crate::{ + Builder, BuilderExt, Context, Op, Operation, Report, Spanned, Value, attributes::Overflow, dialects::test::{self, Add}, pass::{Nesting, PassManager}, - Builder, BuilderExt, Context, Op, Operation, Report, Spanned, Value, }; derive! { diff --git a/hir/src/dialects/builtin/builders.rs b/hir/src/dialects/builtin/builders.rs index 5e0bbff28..efd1e2fe2 100644 --- a/hir/src/dialects/builtin/builders.rs +++ b/hir/src/dialects/builtin/builders.rs @@ -6,8 +6,8 @@ mod world; pub use self::{component::*, function::*, module::*, world::*}; use super::ops::*; use crate::{ - constants::ConstantData, Builder, BuilderExt, Ident, Immediate, OpBuilder, Report, Signature, - SourceSpan, Spanned, Type, UnsafeIntrusiveEntityRef, ValueRef, Visibility, + Builder, BuilderExt, Ident, Immediate, OpBuilder, Report, Signature, SourceSpan, Spanned, Type, + UnsafeIntrusiveEntityRef, ValueRef, Visibility, constants::ConstantData, }; pub trait BuiltinOpBuilder<'f, B: ?Sized + Builder> { diff --git a/hir/src/dialects/builtin/builders/component.rs b/hir/src/dialects/builtin/builders/component.rs index e3e636e27..87217b61f 100644 --- a/hir/src/dialects/builtin/builders/component.rs +++ b/hir/src/dialects/builtin/builders/component.rs @@ -1,7 +1,7 @@ use super::BuiltinOpBuilder; use crate::{ - dialects::builtin::{ComponentRef, FunctionRef, InterfaceRef, Module, ModuleRef}, Builder, Ident, Op, OpBuilder, Report, Signature, SymbolName, SymbolPath, SymbolTable, + dialects::builtin::{ComponentRef, FunctionRef, InterfaceRef, Module, ModuleRef}, }; pub struct ComponentBuilder { diff --git a/hir/src/dialects/builtin/builders/module.rs b/hir/src/dialects/builtin/builders/module.rs index f6de35541..2ac2c5d10 100644 --- a/hir/src/dialects/builtin/builders/module.rs +++ b/hir/src/dialects/builtin/builders/module.rs @@ -1,12 +1,12 @@ use super::BuiltinOpBuilder; use crate::{ + Builder, Ident, Op, OpBuilder, Report, Signature, SourceSpan, Spanned, SymbolName, SymbolTable, + Type, UnsafeIntrusiveEntityRef, Visibility, constants::ConstantData, dialects::builtin::{ Function, FunctionRef, GlobalVariable, GlobalVariableRef, Module, ModuleRef, PrimModuleBuilder, Segment, }, - Builder, Ident, Op, OpBuilder, Report, Signature, SourceSpan, Spanned, SymbolName, SymbolTable, - Type, UnsafeIntrusiveEntityRef, Visibility, }; /// A specialized builder for constructing/modifying [crate::dialects::hir::Module] diff --git a/hir/src/dialects/builtin/builders/world.rs b/hir/src/dialects/builtin/builders/world.rs index f42de3b3e..0e004db75 100644 --- a/hir/src/dialects/builtin/builders/world.rs +++ b/hir/src/dialects/builtin/builders/world.rs @@ -1,13 +1,13 @@ use alloc::format; use crate::{ + Builder, Ident, Op, OpBuilder, Report, Spanned, SymbolName, SymbolNameComponent, SymbolPath, + SymbolTable, UnsafeIntrusiveEntityRef, dialects::builtin::{ Component, ComponentId, ComponentRef, Module, ModuleBuilder, ModuleRef, PrimComponentBuilder, PrimModuleBuilder, World, WorldRef, }, version::Version, - Builder, Ident, Op, OpBuilder, Report, Spanned, SymbolName, SymbolNameComponent, SymbolPath, - SymbolTable, UnsafeIntrusiveEntityRef, }; pub struct WorldBuilder { diff --git a/hir/src/dialects/builtin/ops/cast.rs b/hir/src/dialects/builtin/ops/cast.rs index 4f3ce1912..5dab2ba37 100644 --- a/hir/src/dialects/builtin/ops/cast.rs +++ b/hir/src/dialects/builtin/ops/cast.rs @@ -1,9 +1,9 @@ use crate::{ + Context, Report, Spanned, Type, Value, derive::operation, dialects::builtin::BuiltinDialect, effects::{EffectIterator, EffectOpInterface, MemoryEffect, MemoryEffectOpInterface}, traits::{AnyType, InferTypeOpInterface, UnaryOp}, - Context, Report, Spanned, Type, Value, }; #[operation( diff --git a/hir/src/dialects/builtin/ops/component.rs b/hir/src/dialects/builtin/ops/component.rs index 71a37fcb9..8872ff398 100644 --- a/hir/src/dialects/builtin/ops/component.rs +++ b/hir/src/dialects/builtin/ops/component.rs @@ -4,6 +4,9 @@ pub use self::interface::{ ComponentExport, ComponentId, ComponentInterface, ModuleExport, ModuleInterface, }; use crate::{ + Ident, OpPrinter, Operation, RegionKind, RegionKindInterface, Symbol, SymbolManager, + SymbolManagerMut, SymbolMap, SymbolName, SymbolRef, SymbolTable, SymbolUseList, + UnsafeIntrusiveEntityRef, Usable, Visibility, derive::operation, dialects::builtin::BuiltinDialect, traits::{ @@ -11,9 +14,6 @@ use crate::{ NoTerminator, SingleBlock, SingleRegion, }, version::Version, - Ident, OpPrinter, Operation, RegionKind, RegionKindInterface, Symbol, SymbolManager, - SymbolManagerMut, SymbolMap, SymbolName, SymbolRef, SymbolTable, SymbolUseList, - UnsafeIntrusiveEntityRef, Usable, Visibility, }; pub type ComponentRef = UnsafeIntrusiveEntityRef; diff --git a/hir/src/dialects/builtin/ops/component/interface.rs b/hir/src/dialects/builtin/ops/component/interface.rs index af591dfb3..65b0e9bb7 100644 --- a/hir/src/dialects/builtin/ops/component/interface.rs +++ b/hir/src/dialects/builtin/ops/component/interface.rs @@ -3,11 +3,11 @@ use core::fmt; use super::Component; use crate::{ - diagnostics::{miette, Diagnostic}, - dialects::builtin::{Function, Module}, - version::Version, FxHashMap, Signature, Symbol, SymbolName, SymbolNameComponent, SymbolPath, SymbolTable, Type, Visibility, + diagnostics::{Diagnostic, miette}, + dialects::builtin::{Function, Module}, + version::Version, }; /// The fully-qualfied identifier of a component diff --git a/hir/src/dialects/builtin/ops/function.rs b/hir/src/dialects/builtin/ops/function.rs index 95004f693..2c4d15cf8 100644 --- a/hir/src/dialects/builtin/ops/function.rs +++ b/hir/src/dialects/builtin/ops/function.rs @@ -3,14 +3,13 @@ use alloc::format; use smallvec::SmallVec; use crate::{ - define_attr_type, - derive::operation, - dialects::builtin::BuiltinDialect, - traits::{AnyType, IsolatedFromAbove, ReturnLike, SingleRegion, Terminator}, AttrPrinter, BlockRef, CallableOpInterface, Context, Ident, Immediate, Op, OpPrinter, OpPrintingFlags, Operation, RegionKind, RegionKindInterface, RegionRef, Signature, Symbol, SymbolName, SymbolUse, SymbolUseList, Type, UnsafeIntrusiveEntityRef, Usable, ValueRef, - Visibility, + Visibility, define_attr_type, + derive::operation, + dialects::builtin::BuiltinDialect, + traits::{AnyType, IsolatedFromAbove, ReturnLike, SingleRegion, Terminator}, }; trait UsableSymbol = Usable; diff --git a/hir/src/dialects/builtin/ops/global_variable.rs b/hir/src/dialects/builtin/ops/global_variable.rs index c46c0cf10..732588788 100644 --- a/hir/src/dialects/builtin/ops/global_variable.rs +++ b/hir/src/dialects/builtin/ops/global_variable.rs @@ -1,6 +1,9 @@ use smallvec::smallvec; use crate::{ + AsSymbolRef, Context, Ident, Op, OpPrinter, Operation, PointerType, Report, Spanned, Symbol, + SymbolName, SymbolRef, SymbolUseList, Type, UnsafeIntrusiveEntityRef, Usable, Value, + Visibility, derive::operation, dialects::builtin::BuiltinDialect, effects::{ @@ -11,9 +14,6 @@ use crate::{ InferTypeOpInterface, IsolatedFromAbove, NoRegionArguments, PointerOf, SingleBlock, SingleRegion, UInt8, }, - AsSymbolRef, Context, Ident, Op, OpPrinter, Operation, PointerType, Report, Spanned, Symbol, - SymbolName, SymbolRef, SymbolUseList, Type, UnsafeIntrusiveEntityRef, Usable, Value, - Visibility, }; pub type GlobalVariableRef = UnsafeIntrusiveEntityRef; diff --git a/hir/src/dialects/builtin/ops/interface.rs b/hir/src/dialects/builtin/ops/interface.rs index 856b18a99..a58e931fa 100644 --- a/hir/src/dialects/builtin/ops/interface.rs +++ b/hir/src/dialects/builtin/ops/interface.rs @@ -1,15 +1,15 @@ use midenc_session::LibraryPath; use crate::{ + Ident, Op, Operation, RegionKind, RegionKindInterface, Symbol, SymbolManager, SymbolManagerMut, + SymbolMap, SymbolName, SymbolRef, SymbolTable, SymbolUseList, UnsafeIntrusiveEntityRef, Usable, + Visibility, derive::operation, dialects::builtin::{self, BuiltinDialect}, traits::{ GraphRegionNoTerminator, HasOnlyGraphRegion, IsolatedFromAbove, NoRegionArguments, NoTerminator, SingleBlock, SingleRegion, }, - Ident, Op, Operation, RegionKind, RegionKindInterface, Symbol, SymbolManager, SymbolManagerMut, - SymbolMap, SymbolName, SymbolRef, SymbolTable, SymbolUseList, UnsafeIntrusiveEntityRef, Usable, - Visibility, }; pub type InterfaceRef = UnsafeIntrusiveEntityRef; diff --git a/hir/src/dialects/builtin/ops/module.rs b/hir/src/dialects/builtin/ops/module.rs index bf20c76f4..2628109de 100644 --- a/hir/src/dialects/builtin/ops/module.rs +++ b/hir/src/dialects/builtin/ops/module.rs @@ -1,13 +1,13 @@ use crate::{ + Ident, OpPrinter, Operation, RegionKind, RegionKindInterface, Symbol, SymbolManager, + SymbolManagerMut, SymbolMap, SymbolName, SymbolRef, SymbolTable, SymbolUseList, + UnsafeIntrusiveEntityRef, Usable, Visibility, derive::operation, dialects::builtin::BuiltinDialect, traits::{ GraphRegionNoTerminator, HasOnlyGraphRegion, IsolatedFromAbove, NoRegionArguments, NoTerminator, SingleBlock, SingleRegion, }, - Ident, OpPrinter, Operation, RegionKind, RegionKindInterface, Symbol, SymbolManager, - SymbolManagerMut, SymbolMap, SymbolName, SymbolRef, SymbolTable, SymbolUseList, - UnsafeIntrusiveEntityRef, Usable, Visibility, }; pub type ModuleRef = UnsafeIntrusiveEntityRef; diff --git a/hir/src/dialects/builtin/ops/segment.rs b/hir/src/dialects/builtin/ops/segment.rs index 354461b25..f1f45ceb0 100644 --- a/hir/src/dialects/builtin/ops/segment.rs +++ b/hir/src/dialects/builtin/ops/segment.rs @@ -2,13 +2,13 @@ use alloc::{collections::VecDeque, format, sync::Arc}; use core::fmt; use midenc_hir_macros::operation; -use midenc_session::diagnostics::{miette, Diagnostic}; +use midenc_session::diagnostics::{Diagnostic, miette}; use crate::{ + Alignable, Op, OpPrinter, UnsafeIntrusiveEntityRef, constants::{ConstantData, ConstantId}, dialects::builtin::BuiltinDialect, traits::*, - Alignable, Op, OpPrinter, UnsafeIntrusiveEntityRef, }; pub type SegmentRef = UnsafeIntrusiveEntityRef; diff --git a/hir/src/dialects/builtin/ops/world.rs b/hir/src/dialects/builtin/ops/world.rs index 9a922b632..d7ae71f65 100644 --- a/hir/src/dialects/builtin/ops/world.rs +++ b/hir/src/dialects/builtin/ops/world.rs @@ -1,12 +1,12 @@ use crate::{ + Operation, RegionKind, RegionKindInterface, SymbolManager, SymbolManagerMut, SymbolMap, + SymbolName, SymbolRef, SymbolTable, SymbolUseList, UnsafeIntrusiveEntityRef, Usable, derive::operation, dialects::builtin::BuiltinDialect, traits::{ GraphRegionNoTerminator, HasOnlyGraphRegion, IsolatedFromAbove, NoRegionArguments, NoTerminator, SingleBlock, SingleRegion, }, - Operation, RegionKind, RegionKindInterface, SymbolManager, SymbolManagerMut, SymbolMap, - SymbolName, SymbolRef, SymbolTable, SymbolUseList, UnsafeIntrusiveEntityRef, Usable, }; pub type WorldRef = UnsafeIntrusiveEntityRef; diff --git a/hir/src/dialects/test/builders.rs b/hir/src/dialects/test/builders.rs index 5ff5009ef..117247490 100644 --- a/hir/src/dialects/test/builders.rs +++ b/hir/src/dialects/test/builders.rs @@ -1,6 +1,6 @@ use crate::{ - dialects::{builtin::FunctionBuilder, test::*}, Builder, BuilderExt, OpBuilder, Report, UnsafeIntrusiveEntityRef, ValueRef, + dialects::{builtin::FunctionBuilder, test::*}, }; pub trait TestOpBuilder<'f, B: ?Sized + Builder> { diff --git a/hir/src/folder.rs b/hir/src/folder.rs index 360103a73..1a3eefe16 100644 --- a/hir/src/folder.rs +++ b/hir/src/folder.rs @@ -1,14 +1,14 @@ use alloc::{boxed::Box, rc::Rc}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use crate::{ + AttributeValue, BlockRef, Builder, Context, Dialect, FoldResult, FxHashMap, OpFoldResult, + OperationRef, ProgramPoint, RegionRef, Rewriter, SourceSpan, Spanned, Type, Value, ValueRef, adt::SmallDenseMap, matchers::Matcher, patterns::{RewriterImpl, RewriterListener}, traits::{ConstantLike, Foldable, IsolatedFromAbove}, - AttributeValue, BlockRef, Builder, Context, Dialect, FoldResult, FxHashMap, OpFoldResult, - OperationRef, ProgramPoint, RegionRef, Rewriter, SourceSpan, Spanned, Type, Value, ValueRef, }; /// Represents a constant value uniqued by dialect, value, and type. diff --git a/hir/src/ir.rs b/hir/src/ir.rs index 00441f32c..61e217530 100644 --- a/hir/src/ir.rs +++ b/hir/src/ir.rs @@ -52,8 +52,8 @@ pub use self::{ OpOperandStorage, }, operation::{ - equivalence, OpCursor, OpCursorMut, OpList, Operation, OperationBuilder, OperationName, - OperationRef, + OpCursor, OpCursorMut, OpList, Operation, OperationBuilder, OperationName, OperationRef, + equivalence, }, print::{AttrPrinter, OpPrinter, OpPrintingFlags}, region::{ diff --git a/hir/src/ir/cfg/diff.rs b/hir/src/ir/cfg/diff.rs index fd02878f2..a2fdabe4d 100644 --- a/hir/src/ir/cfg/diff.rs +++ b/hir/src/ir/cfg/diff.rs @@ -2,7 +2,7 @@ use core::fmt; use smallvec::SmallVec; -use crate::{adt::SmallDenseMap, BlockRef}; +use crate::{BlockRef, adt::SmallDenseMap}; #[derive(Copy, Clone, PartialEq, Eq)] pub enum CfgUpdateKind { diff --git a/hir/src/ir/context.rs b/hir/src/ir/context.rs index 0fc55323d..26ae1c5af 100644 --- a/hir/src/ir/context.rs +++ b/hir/src/ir/context.rs @@ -10,8 +10,8 @@ use traits::BranchOpInterface; use super::{traits::BuildableTypeConstraint, *}; use crate::{ - constants::{ConstantData, ConstantId, ConstantPool}, FxHashMap, + constants::{ConstantData, ConstantId, ConstantPool}, }; /// Represents the shared state of the IR, used during a compilation session. diff --git a/hir/src/ir/dialect.rs b/hir/src/ir/dialect.rs index 7b60934cc..5cf087a42 100644 --- a/hir/src/ir/dialect.rs +++ b/hir/src/ir/dialect.rs @@ -5,7 +5,7 @@ use core::ptr::{DynMetadata, Pointee}; pub use self::info::DialectInfo; use crate::{ - any::AsAny, interner, AttributeValue, Builder, OperationName, OperationRef, SourceSpan, Type, + AttributeValue, Builder, OperationName, OperationRef, SourceSpan, Type, any::AsAny, interner, }; pub type DialectRegistrationHook = Box; diff --git a/hir/src/ir/dialect/info.rs b/hir/src/ir/dialect/info.rs index 39f175536..a6212e393 100644 --- a/hir/src/ir/dialect/info.rs +++ b/hir/src/ir/dialect/info.rs @@ -6,7 +6,7 @@ use core::{ }; use super::{Dialect, DialectRegistration}; -use crate::{interner, traits::TraitInfo, FxHashMap, OpRegistration, OperationName}; +use crate::{FxHashMap, OpRegistration, OperationName, interner, traits::TraitInfo}; pub struct DialectInfo { /// The namespace of this dialect diff --git a/hir/src/ir/dominance/frontier.rs b/hir/src/ir/dominance/frontier.rs index 6fe701701..2f49b2e62 100644 --- a/hir/src/ir/dominance/frontier.rs +++ b/hir/src/ir/dominance/frontier.rs @@ -2,8 +2,8 @@ use alloc::collections::VecDeque; use super::*; use crate::{ - adt::{SmallDenseMap, SmallSet}, BlockArgument, BlockRef, ValueRef, + adt::{SmallDenseMap, SmallSet}, }; /// Calculates the dominance frontier for every block in a given `DominatorTree` diff --git a/hir/src/ir/dominance/info.rs b/hir/src/ir/dominance/info.rs index e5247a84c..a40e913bb 100644 --- a/hir/src/ir/dominance/info.rs +++ b/hir/src/ir/dominance/info.rs @@ -5,8 +5,8 @@ use smallvec::SmallVec; use super::*; use crate::{ - adt::SmallDenseMap, pass::Analysis, Block, BlockRef, Operation, OperationRef, - RegionKindInterface, RegionRef, Report, + Block, BlockRef, Operation, OperationRef, RegionKindInterface, RegionRef, Report, + adt::SmallDenseMap, pass::Analysis, }; /// [DominanceInfo] provides a high-level API for querying dominance information. diff --git a/hir/src/ir/dominance/tree.rs b/hir/src/ir/dominance/tree.rs index bc9b1292d..8e58aa838 100644 --- a/hir/src/ir/dominance/tree.rs +++ b/hir/src/ir/dominance/tree.rs @@ -5,13 +5,13 @@ use core::{ num::NonZeroU32, }; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use super::{BatchUpdateInfo, SemiNCA}; use crate::{ + BlockRef, EntityId, EntityWithId, RegionRef, cfg::{self, Graph, Inverse, InvertibleGraph}, formatter::DisplayOptional, - BlockRef, EntityId, EntityWithId, RegionRef, }; #[derive(Debug, thiserror::Error)] diff --git a/hir/src/ir/effects/instance.rs b/hir/src/ir/effects/instance.rs index 991df041a..274a6a7d2 100644 --- a/hir/src/ir/effects/instance.rs +++ b/hir/src/ir/effects/instance.rs @@ -3,8 +3,8 @@ use core::fmt; use super::{DefaultResource, Effect, Resource}; use crate::{ - interner, AttributeSet, AttributeValue, BlockArgument, BlockArgumentRef, EntityRef, OpOperand, - OpOperandImpl, OpResult, OpResultRef, SymbolRef, Value, ValueRef, + AttributeSet, AttributeValue, BlockArgument, BlockArgumentRef, EntityRef, OpOperand, + OpOperandImpl, OpResult, OpResultRef, SymbolRef, Value, ValueRef, interner, }; #[derive(Clone)] diff --git a/hir/src/ir/entity/storage.rs b/hir/src/ir/entity/storage.rs index 99478d811..c3cba0f0c 100644 --- a/hir/src/ir/entity/storage.rs +++ b/hir/src/ir/entity/storage.rs @@ -1,6 +1,6 @@ use core::fmt; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use super::{EntityGroup, StorableEntity}; diff --git a/hir/src/ir/ident.rs b/hir/src/ir/ident.rs index e542defd9..363238640 100644 --- a/hir/src/ir/ident.rs +++ b/hir/src/ir/ident.rs @@ -9,8 +9,8 @@ use core::{ use anyhow::anyhow; use super::{ - interner::{symbols, Symbol}, SourceSpan, Spanned, + interner::{Symbol, symbols}, }; use crate::{ define_attr_type, diff --git a/hir/src/ir/op.rs b/hir/src/ir/op.rs index 42a60c522..52ee551c4 100644 --- a/hir/src/ir/op.rs +++ b/hir/src/ir/op.rs @@ -1,7 +1,7 @@ use alloc::{boxed::Box, format}; use super::*; -use crate::{any::AsAny, traits::TraitInfo, AttributeValue}; +use crate::{AttributeValue, any::AsAny, traits::TraitInfo}; pub trait OpRegistration: Op { /// The name of the dialect this op is declared part of diff --git a/hir/src/ir/operation/builder.rs b/hir/src/ir/operation/builder.rs index dbd5b66e0..3207325ad 100644 --- a/hir/src/ir/operation/builder.rs +++ b/hir/src/ir/operation/builder.rs @@ -3,9 +3,9 @@ use alloc::{boxed::Box, vec, vec::Vec}; use midenc_session::diagnostics::Severity; use crate::{ - traits::Terminator, AsCallableSymbolRef, AsSymbolRef, AttributeValue, BlockRef, Builder, - KeyedSuccessor, Op, OpBuilder, OperationRef, Region, Report, Spanned, SuccessorInfo, Type, - UnsafeIntrusiveEntityRef, ValueRef, + AsCallableSymbolRef, AsSymbolRef, AttributeValue, BlockRef, Builder, KeyedSuccessor, Op, + OpBuilder, OperationRef, Region, Report, Spanned, SuccessorInfo, Type, + UnsafeIntrusiveEntityRef, ValueRef, traits::Terminator, }; /// The [OperationBuilder] is a primitive for imperatively constructing an [Operation]. diff --git a/hir/src/ir/operation/equivalence.rs b/hir/src/ir/operation/equivalence.rs index c445f6bae..6f2130928 100644 --- a/hir/src/ir/operation/equivalence.rs +++ b/hir/src/ir/operation/equivalence.rs @@ -4,7 +4,7 @@ use bitflags::bitflags; use smallvec::SmallVec; use super::Operation; -use crate::{traits::Commutative, OpOperand, Region, Value, ValueRef}; +use crate::{OpOperand, Region, Value, ValueRef, traits::Commutative}; bitflags! { #[derive(Copy, Clone)] diff --git a/hir/src/ir/print.rs b/hir/src/ir/print.rs index d83bada89..a358ee0ce 100644 --- a/hir/src/ir/print.rs +++ b/hir/src/ir/print.rs @@ -3,10 +3,10 @@ use core::fmt; use super::{Context, Operation}; use crate::{ + AttributeValue, EntityWithId, SuccessorOperands, Value, formatter::{Document, PrettyPrint}, matchers::Matcher, traits::BranchOpInterface, - AttributeValue, EntityWithId, SuccessorOperands, Value, }; #[derive(Debug)] diff --git a/hir/src/ir/region.rs b/hir/src/ir/region.rs index 61676e405..8947f4dde 100644 --- a/hir/src/ir/region.rs +++ b/hir/src/ir/region.rs @@ -20,10 +20,10 @@ pub use self::{ }; use super::*; use crate::{ + Forward, adt::SmallSet, patterns::RegionSimplificationLevel, traits::{SingleBlock, SingleRegion}, - Forward, }; pub type RegionRef = UnsafeIntrusiveEntityRef; diff --git a/hir/src/ir/region/interfaces.rs b/hir/src/ir/region/interfaces.rs index e166af2a2..df01e9d9f 100644 --- a/hir/src/ir/region/interfaces.rs +++ b/hir/src/ir/region/interfaces.rs @@ -2,8 +2,8 @@ use alloc::boxed::Box; use super::*; use crate::{ - attributes::AttributeValue, traits::Terminator, Op, SuccessorOperandRange, - SuccessorOperandRangeMut, Type, + Op, SuccessorOperandRange, SuccessorOperandRangeMut, Type, attributes::AttributeValue, + traits::Terminator, }; /// An op interface that indicates what types of regions it holds @@ -376,10 +376,6 @@ impl dyn LoopLikeOpInterface { /// Return the single step value or attribute if it exists, otherwise return `None` pub fn get_single_step(&self) -> Option { let mut steps = self.get_loop_steps()?; - if steps.len() == 1 { - steps.pop() - } else { - None - } + if steps.len() == 1 { steps.pop() } else { None } } } diff --git a/hir/src/ir/region/transforms/block_merging.rs b/hir/src/ir/region/transforms/block_merging.rs index 57c38af91..e1c1bf844 100644 --- a/hir/src/ir/region/transforms/block_merging.rs +++ b/hir/src/ir/region/transforms/block_merging.rs @@ -3,8 +3,8 @@ use alloc::boxed::Box; use super::RegionTransformFailed; use crate::{ - adt::SmallDenseMap, BlockArgument, BlockRef, DynHash, OpResult, Operation, OperationRef, - Region, RegionRef, Rewriter, ValueRef, + BlockArgument, BlockRef, DynHash, OpResult, Operation, OperationRef, Region, RegionRef, + Rewriter, ValueRef, adt::SmallDenseMap, }; bitflags::bitflags! { diff --git a/hir/src/ir/traits.rs b/hir/src/ir/traits.rs index d82c6603c..5c3071139 100644 --- a/hir/src/ir/traits.rs +++ b/hir/src/ir/traits.rs @@ -14,7 +14,7 @@ pub use self::{ types::*, }; use super::BlockRef; -use crate::{derive, AttributeValue, Context, Operation, Report, Spanned}; +use crate::{AttributeValue, Context, Operation, Report, Spanned, derive}; /// Marker trait for commutative ops, e.g. `X op Y == Y op X` pub trait Commutative {} diff --git a/hir/src/ir/traits/canonicalization.rs b/hir/src/ir/traits/canonicalization.rs index aedb67807..f7f73101b 100644 --- a/hir/src/ir/traits/canonicalization.rs +++ b/hir/src/ir/traits/canonicalization.rs @@ -1,6 +1,6 @@ use alloc::rc::Rc; -use crate::{patterns::RewritePatternSet, Context, Op}; +use crate::{Context, Op, patterns::RewritePatternSet}; /// This trait represents an [Op] that has a canonical/normal form. /// diff --git a/hir/src/ir/traits/types.rs b/hir/src/ir/traits/types.rs index 592777169..738abab64 100644 --- a/hir/src/ir/traits/types.rs +++ b/hir/src/ir/traits/types.rs @@ -4,7 +4,7 @@ use core::fmt; use midenc_hir_type::PointerType; use midenc_session::diagnostics::Severity; -use crate::{derive, ir::value::Value, Context, Op, Operation, Report, Type}; +use crate::{Context, Op, Operation, Report, Type, derive, ir::value::Value}; /// OpInterface to compute the return type(s) of an operation. pub trait InferTypeOpInterface: Op { diff --git a/hir/src/ir/usable.rs b/hir/src/ir/usable.rs index 846fab6fe..debfc1540 100644 --- a/hir/src/ir/usable.rs +++ b/hir/src/ir/usable.rs @@ -1,6 +1,6 @@ use super::{ - entity::EntityIter, EntityCursor, EntityCursorMut, EntityList, EntityListItem, - UnsafeIntrusiveEntityRef, + EntityCursor, EntityCursorMut, EntityList, EntityListItem, UnsafeIntrusiveEntityRef, + entity::EntityIter, }; /// The [Usable] trait is implemented for IR entities which are _defined_ and _used_, and as a diff --git a/hir/src/ir/value/range.rs b/hir/src/ir/value/range.rs index 1d8b8e1a4..4f97693cc 100644 --- a/hir/src/ir/value/range.rs +++ b/hir/src/ir/value/range.rs @@ -1,6 +1,6 @@ use core::borrow::Borrow; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use super::*; use crate::adt::SmallSet; diff --git a/hir/src/ir/verifier.rs b/hir/src/ir/verifier.rs index 0edd7fec3..af38c1d14 100644 --- a/hir/src/ir/verifier.rs +++ b/hir/src/ir/verifier.rs @@ -248,7 +248,7 @@ mod tests { use core::hint::black_box; use super::*; - use crate::{traits::SingleBlock, Operation}; + use crate::{Operation, traits::SingleBlock}; struct Vacuous; diff --git a/hir/src/lib.rs b/hir/src/lib.rs index fbf0e6f25..451846177 100644 --- a/hir/src/lib.rs +++ b/hir/src/lib.rs @@ -53,7 +53,7 @@ pub use compact_str::{ CompactString as SmallStr, CompactStringExt as SmallStrExt, ToCompactString as ToSmallStr, }; pub use hashbrown; -pub use smallvec::{smallvec, SmallVec, ToSmallVec}; +pub use smallvec::{SmallVec, ToSmallVec, smallvec}; pub type FxHashMap = hashbrown::HashMap; pub type FxHashSet = hashbrown::HashSet; @@ -83,8 +83,8 @@ pub use midenc_session::diagnostics; pub use self::{ attributes::{ - markers::*, ArrayAttr, Attribute, AttributeSet, AttributeValue, DictAttr, Overflow, - SetAttr, Visibility, + ArrayAttr, Attribute, AttributeSet, AttributeValue, DictAttr, Overflow, SetAttr, + Visibility, markers::*, }, direction::{Backward, Direction, Forward}, eq::DynPartialEq, diff --git a/hir/src/matchers/matcher.rs b/hir/src/matchers/matcher.rs index ba04d4d9d..579ed0bb6 100644 --- a/hir/src/matchers/matcher.rs +++ b/hir/src/matchers/matcher.rs @@ -683,17 +683,23 @@ mod tests { let lhs_op = lhs.borrow().get_defining_op().unwrap(); // Ensure if the first matcher fails, then the whole match fails - assert!(match_both(match_op::(), constant_of::()) - .matches(&lhs_op.borrow()) - .is_none()); + assert!( + match_both(match_op::(), constant_of::()) + .matches(&lhs_op.borrow()) + .is_none() + ); // Ensure if the second matcher fails, then the whole match fails - assert!(match_both(constant_like(), constant_of::()) - .matches(&lhs_op.borrow()) - .is_none()); + assert!( + match_both(constant_like(), constant_of::()) + .matches(&lhs_op.borrow()) + .is_none() + ); // Ensure that if both matchers would succeed, then the whole match succeeds - assert!(match_both(constant_like(), constant_of::()) - .matches(&lhs_op.borrow()) - .is_some()); + assert!( + match_both(constant_like(), constant_of::()) + .matches(&lhs_op.borrow()) + .is_some() + ); } #[test] diff --git a/hir/src/pass/instrumentation.rs b/hir/src/pass/instrumentation.rs index ccddaac05..9acba111b 100644 --- a/hir/src/pass/instrumentation.rs +++ b/hir/src/pass/instrumentation.rs @@ -5,7 +5,7 @@ use compact_str::CompactString; use smallvec::SmallVec; use super::OperationPass; -use crate::{pass::PassExecutionState, OperationName, OperationRef}; +use crate::{OperationName, OperationRef, pass::PassExecutionState}; #[allow(unused_variables)] pub trait PassInstrumentation { diff --git a/hir/src/pass/specialization.rs b/hir/src/pass/specialization.rs index 502d08376..8fc92989d 100644 --- a/hir/src/pass/specialization.rs +++ b/hir/src/pass/specialization.rs @@ -1,6 +1,6 @@ use crate::{ - traits::BranchOpInterface, Context, EntityMut, EntityRef, Op, Operation, OperationName, - OperationRef, Symbol, SymbolTable, + Context, EntityMut, EntityRef, Op, Operation, OperationName, OperationRef, Symbol, SymbolTable, + traits::BranchOpInterface, }; pub trait PassTarget { diff --git a/hir/src/pass/statistics.rs b/hir/src/pass/statistics.rs index 4bbe212c3..5a995ba1a 100644 --- a/hir/src/pass/statistics.rs +++ b/hir/src/pass/statistics.rs @@ -434,7 +434,7 @@ where } fn pretty_print(&self) -> crate::formatter::Document { - use crate::formatter::{const_text, indent, nl, text, Document}; + use crate::formatter::{Document, const_text, indent, nl, text}; if self.is_empty() { const_text("{}") } else { diff --git a/hir/src/patterns/driver.rs b/hir/src/patterns/driver.rs index 901f7f572..d0444ecf3 100644 --- a/hir/src/patterns/driver.rs +++ b/hir/src/patterns/driver.rs @@ -8,12 +8,12 @@ use super::{ RewriterListener, }; use crate::{ - adt::SmallSet, - patterns::{PatternApplicationError, RewritePattern}, - traits::{ConstantLike, Foldable, IsolatedFromAbove}, AttrPrinter, BlockRef, Builder, Context, Forward, InsertionGuard, Listener, OpFoldResult, OperationFolder, OperationRef, ProgramPoint, RawWalk, Region, RegionRef, Report, SourceSpan, Spanned, Value, ValueRef, WalkResult, + adt::SmallSet, + patterns::{PatternApplicationError, RewritePattern}, + traits::{ConstantLike, Foldable, IsolatedFromAbove}, }; /// Rewrite ops in the given region, which must be isolated from above, by repeatedly applying the diff --git a/hir/src/patterns/pattern.rs b/hir/src/patterns/pattern.rs index 277a93ae4..50eb3ae56 100644 --- a/hir/src/patterns/pattern.rs +++ b/hir/src/patterns/pattern.rs @@ -4,7 +4,7 @@ use core::{any::TypeId, fmt}; use smallvec::SmallVec; use super::Rewriter; -use crate::{interner, Context, OperationName, OperationRef, Report}; +use crate::{Context, OperationName, OperationRef, Report, interner}; #[derive(Debug)] pub enum PatternKind { @@ -266,7 +266,7 @@ mod tests { op: OperationRef, rewriter: &mut dyn Rewriter, ) -> Result { - use crate::matchers::{self, match_chain, match_op, MatchWith, Matcher}; + use crate::matchers::{self, MatchWith, Matcher, match_chain, match_op}; let binder = MatchWith(|op: &UnsafeIntrusiveEntityRef| { log::trace!( diff --git a/midenc-compile/src/compiler.rs b/midenc-compile/src/compiler.rs index 8e954c446..413182e07 100644 --- a/midenc-compile/src/compiler.rs +++ b/midenc-compile/src/compiler.rs @@ -5,13 +5,12 @@ use alloc::{string::String, sync::Arc, vec::Vec}; use std::ffi::OsString; #[cfg(feature = "std")] -use clap::{builder::ArgPredicate, Parser}; +use clap::{Parser, builder::ArgPredicate}; use midenc_session::{ - add_target_link_libraries, - diagnostics::{DefaultSourceManager, Emitter}, ColorChoice, DebugInfo, InputFile, LinkLibrary, OptLevel, Options, OutputFile, OutputType, OutputTypeSpec, OutputTypes, Path, PathBuf, ProjectType, Session, TargetEnv, Verbosity, - Warnings, + Warnings, add_target_link_libraries, + diagnostics::{DefaultSourceManager, Emitter}, }; /// Compile a program from WebAssembly or Miden IR, to Miden Assembly. diff --git a/midenc-compile/src/lib.rs b/midenc-compile/src/lib.rs index a85797b37..1512ca861 100644 --- a/midenc-compile/src/lib.rs +++ b/midenc-compile/src/lib.rs @@ -14,8 +14,8 @@ use alloc::{rc::Rc, vec::Vec}; pub use midenc_hir::Context; use midenc_hir::Op; use midenc_session::{ - diagnostics::{miette, Diagnostic, Report, WrapErr}, OutputMode, + diagnostics::{Diagnostic, Report, WrapErr, miette}, }; pub use self::{ @@ -85,8 +85,9 @@ where .next(CodegenStage) .next( pre_assembly_stage - as &mut (dyn FnMut(CodegenOutput, Rc) -> CompilerResult - + '_), + as &mut ( + dyn FnMut(CodegenOutput, Rc) -> CompilerResult + '_ + ), ) .next(AssembleStage); @@ -138,8 +139,9 @@ where let mut stages = CodegenStage .next( pre_assembly_stage - as &mut (dyn FnMut(CodegenOutput, Rc) -> CompilerResult - + '_), + as &mut ( + dyn FnMut(CodegenOutput, Rc) -> CompilerResult + '_ + ), ) .next(AssembleStage); diff --git a/midenc-compile/src/stages/assemble.rs b/midenc-compile/src/stages/assemble.rs index d0a12053a..f82aa48ca 100644 --- a/midenc-compile/src/stages/assemble.rs +++ b/midenc-compile/src/stages/assemble.rs @@ -2,7 +2,7 @@ use alloc::{string::ToString, vec, vec::Vec}; use miden_assembly::ast::QualifiedProcedureName; use miden_mast_package::{Dependency, MastArtifact, Package, PackageExport}; -use midenc_session::{diagnostics::IntoDiagnostic, Session}; +use midenc_session::{Session, diagnostics::IntoDiagnostic}; use super::*; diff --git a/midenc-compile/src/stages/codegen.rs b/midenc-compile/src/stages/codegen.rs index f3b8e858f..ec5490311 100644 --- a/midenc-compile/src/stages/codegen.rs +++ b/midenc-compile/src/stages/codegen.rs @@ -1,14 +1,13 @@ use alloc::{boxed::Box, collections::BTreeMap, sync::Arc, vec::Vec}; -use miden_assembly::{ast::Module, Library}; +use miden_assembly::{Library, ast::Module}; use miden_mast_package::Package; use midenc_codegen_masm::{ - self as masm, + self as masm, MasmComponent, ToMasmComponent, intrinsics::{ - ADVICE_INTRINSICS_MODULE_NAME, CRYPTO_INTRINSICS_MODULE_NAME, I128_INTRINSICS_MODULE_NAME, - I32_INTRINSICS_MODULE_NAME, I64_INTRINSICS_MODULE_NAME, MEM_INTRINSICS_MODULE_NAME, + ADVICE_INTRINSICS_MODULE_NAME, CRYPTO_INTRINSICS_MODULE_NAME, I32_INTRINSICS_MODULE_NAME, + I64_INTRINSICS_MODULE_NAME, I128_INTRINSICS_MODULE_NAME, MEM_INTRINSICS_MODULE_NAME, }, - MasmComponent, ToMasmComponent, }; use midenc_hir::{interner::Symbol, pass::AnalysisManager}; use midenc_session::OutputType; diff --git a/midenc-compile/src/stages/link.rs b/midenc-compile/src/stages/link.rs index dc71a3481..00aaa5573 100644 --- a/midenc-compile/src/stages/link.rs +++ b/midenc-compile/src/stages/link.rs @@ -1,12 +1,12 @@ use alloc::{borrow::ToOwned, collections::BTreeMap, string::ToString, sync::Arc, vec::Vec}; use midenc_frontend_wasm::FrontendOutput; -use midenc_hir::{interner::Symbol, BuilderExt, OpBuilder, SourceSpan}; +use midenc_hir::{BuilderExt, OpBuilder, SourceSpan, interner::Symbol}; #[cfg(feature = "std")] use midenc_session::Path; use midenc_session::{ - diagnostics::{Severity, Spanned}, InputType, OutputMode, OutputType, ProjectType, + diagnostics::{Severity, Spanned}, }; use super::*; diff --git a/midenc-compile/src/stages/mod.rs b/midenc-compile/src/stages/mod.rs index 264cf1661..dc3e04d68 100644 --- a/midenc-compile/src/stages/mod.rs +++ b/midenc-compile/src/stages/mod.rs @@ -1,12 +1,12 @@ use alloc::rc::Rc; use midenc_frontend_wasm as wasm; -use midenc_hir::{dialects::builtin, Context}; +use midenc_hir::{Context, dialects::builtin}; #[cfg(feature = "std")] use midenc_session::diagnostics::WrapErr; use midenc_session::{ - diagnostics::{IntoDiagnostic, Report}, OutputMode, Session, + diagnostics::{IntoDiagnostic, Report}, }; use super::Stage; diff --git a/midenc-compile/src/stages/parse.rs b/midenc-compile/src/stages/parse.rs index 291bd3a02..d19e8203d 100644 --- a/midenc-compile/src/stages/parse.rs +++ b/midenc-compile/src/stages/parse.rs @@ -5,12 +5,12 @@ 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_session::{FileName, Path}; use midenc_session::{ - diagnostics::{IntoDiagnostic, WrapErr}, InputFile, InputType, + diagnostics::{IntoDiagnostic, WrapErr}, }; -#[cfg(feature = "std")] -use midenc_session::{FileName, Path}; use super::*; @@ -145,8 +145,8 @@ impl ParseStage { context: Rc, ) -> CompilerResult { use miden_assembly::{ - ast::{self, Ident, ModuleKind}, LibraryNamespace, LibraryPath, + ast::{self, Ident, ModuleKind}, }; // Construct library path for MASM module @@ -180,8 +180,8 @@ impl ParseStage { context: Rc, ) -> CompilerResult { use miden_assembly::{ - ast::{self, ModuleKind}, LibraryPath, + ast::{self, ModuleKind}, }; let source = core::str::from_utf8(bytes) diff --git a/midenc-compile/src/stages/rewrite.rs b/midenc-compile/src/stages/rewrite.rs index a7d8ffa06..2456f1ee7 100644 --- a/midenc-compile/src/stages/rewrite.rs +++ b/midenc-compile/src/stages/rewrite.rs @@ -3,9 +3,9 @@ use alloc::boxed::Box; use midenc_dialect_hir::transforms::TransformSpills; use midenc_dialect_scf::transforms::LiftControlFlowToSCF; use midenc_hir::{ + Op, pass::{IRPrintingConfig, Nesting, PassManager}, patterns::{GreedyRewriteConfig, RegionSimplificationLevel}, - Op, }; use midenc_hir_transform::{Canonicalizer, ControlFlowSink, SinkOperandDefs}; diff --git a/midenc-driver/src/lib.rs b/midenc-driver/src/lib.rs index 1a980b4df..eed726410 100644 --- a/midenc-driver/src/lib.rs +++ b/midenc-driver/src/lib.rs @@ -5,7 +5,7 @@ mod midenc; pub use clap::Error as ClapError; use log::Log; pub use midenc_session::diagnostics; -use midenc_session::diagnostics::{miette, Diagnostic, Report}; +use midenc_session::diagnostics::{Diagnostic, Report, miette}; pub use self::midenc::Midenc; diff --git a/midenc-driver/src/midenc.rs b/midenc-driver/src/midenc.rs index 2dfa1c658..6bb2bffd6 100644 --- a/midenc-driver/src/midenc.rs +++ b/midenc-driver/src/midenc.rs @@ -5,8 +5,8 @@ use log::Log; use midenc_compile as compile; use midenc_hir::Context; use midenc_session::{ - diagnostics::{Emitter, Report}, InputFile, + diagnostics::{Emitter, Report}, }; use crate::ClapDiagnostic; diff --git a/midenc-session/src/diagnostics.rs b/midenc-session/src/diagnostics.rs index eb1f21d83..457e57c45 100644 --- a/midenc-session/src/diagnostics.rs +++ b/midenc-session/src/diagnostics.rs @@ -12,11 +12,10 @@ use alloc::{ use core::sync::atomic::{AtomicUsize, Ordering}; pub use miden_assembly::diagnostics::{ - miette, + Diagnostic, Label, LabeledSpan, RelatedError, RelatedLabel, Report, Severity, WrapErr, miette, miette::MietteDiagnostic as AdHocDiagnostic, reporting, reporting::{PrintDiagnostic, ReportHandlerOpts}, - Diagnostic, Label, LabeledSpan, RelatedError, RelatedLabel, Report, Severity, WrapErr, }; pub use miden_core::*; pub use miden_debug_types::*; diff --git a/midenc-session/src/emitter.rs b/midenc-session/src/emitter.rs index acc3be2c3..abdcf76ac 100644 --- a/midenc-session/src/emitter.rs +++ b/midenc-session/src/emitter.rs @@ -10,7 +10,7 @@ use midenc_hir_symbol::sync::RwLock; #[cfg(feature = "std")] use crate::diagnostics::IntoDiagnostic; -use crate::{diagnostics::Report, ColorChoice}; +use crate::{ColorChoice, diagnostics::Report}; /// The [Emitter] trait is used for controlling how diagnostics are displayed. /// diff --git a/midenc-session/src/flags/arg_matches.rs b/midenc-session/src/flags/arg_matches.rs index 03ceeb578..0ddadf8d6 100644 --- a/midenc-session/src/flags/arg_matches.rs +++ b/midenc-session/src/flags/arg_matches.rs @@ -16,7 +16,7 @@ mod fallback { }; use core::any::Any; - use crate::{diagnostics::Report, CompileFlag, FlagAction}; + use crate::{CompileFlag, FlagAction, diagnostics::Report}; /// Violation of [`ArgMatches`] assumptions #[derive(Clone, Debug, thiserror::Error)] @@ -114,7 +114,7 @@ mod fallback { None => { return Err(Report::msg(format!( "unexpected positional argument: '{arg}'" - ))) + ))); } }, }; diff --git a/midenc-session/src/libs.rs b/midenc-session/src/libs.rs index fde87fbd1..3d9011ce8 100644 --- a/midenc-session/src/libs.rs +++ b/midenc-session/src/libs.rs @@ -13,12 +13,12 @@ use miden_core::utils::Deserializable; use miden_stdlib::StdLibrary; use midenc_hir_symbol::sync::LazyLock; -use crate::{diagnostics::Report, PathBuf, Session, TargetEnv}; #[cfg(feature = "std")] use crate::{ - diagnostics::{IntoDiagnostic, WrapErr}, Path, + diagnostics::{IntoDiagnostic, WrapErr}, }; +use crate::{PathBuf, Session, TargetEnv, diagnostics::Report}; pub static STDLIB: LazyLock> = LazyLock::new(|| Arc::new(StdLibrary::default().into())); @@ -157,7 +157,7 @@ impl LinkLibrary { return Err(Report::msg(format!( "Expected Miden package to contain a Library, got Program: '{}'", path.display() - ))) + ))); } miden_mast_package::MastArtifact::Library(lib) => lib.clone(), }; diff --git a/midenc-session/src/options/mod.rs b/midenc-session/src/options/mod.rs index f9baa2519..62c915aab 100644 --- a/midenc-session/src/options/mod.rs +++ b/midenc-session/src/options/mod.rs @@ -3,8 +3,8 @@ use alloc::{fmt, str::FromStr, string::String, sync::Arc, vec, vec::Vec}; #[cfg(feature = "std")] use crate::Path; use crate::{ - diagnostics::{DiagnosticsConfig, Emitter}, ColorChoice, CompileFlags, LinkLibrary, OutputTypes, PathBuf, ProjectType, TargetEnv, + diagnostics::{DiagnosticsConfig, Emitter}, }; /// This struct contains all of the configuration options for the compiler diff --git a/midenc/src/main.rs b/midenc/src/main.rs index a5c63bcfd..7797b72c1 100644 --- a/midenc/src/main.rs +++ b/midenc/src/main.rs @@ -1,9 +1,8 @@ use std::env; use midenc_driver::{ - self as driver, + self as driver, ClapDiagnostic, diagnostics::{IntoDiagnostic, Report, WrapErr}, - ClapDiagnostic, }; pub fn main() -> Result<(), Report> { diff --git a/sdk/base-macros/src/account_component_metadata.rs b/sdk/base-macros/src/account_component_metadata.rs index 8223d93b4..c81da9ead 100644 --- a/sdk/base-macros/src/account_component_metadata.rs +++ b/sdk/base-macros/src/account_component_metadata.rs @@ -1,8 +1,8 @@ use std::collections::BTreeSet; use miden_objects::account::{ - component::FieldIdentifier, AccountComponentMetadata, AccountType, MapRepresentation, - StorageEntry, StorageValueName, TemplateType, WordRepresentation, + AccountComponentMetadata, AccountType, MapRepresentation, StorageEntry, StorageValueName, + TemplateType, WordRepresentation, component::FieldIdentifier, }; use semver::Version; diff --git a/sdk/base-macros/src/component_macro/generate_wit.rs b/sdk/base-macros/src/component_macro/generate_wit.rs index 0ee2bb746..594f55213 100644 --- a/sdk/base-macros/src/component_macro/generate_wit.rs +++ b/sdk/base-macros/src/component_macro/generate_wit.rs @@ -10,8 +10,8 @@ use semver::Version; use syn::spanned::Spanned; use crate::{ - component_macro::{to_kebab_case, ComponentMethod, MethodReturn, CORE_TYPES_PACKAGE}, - types::{ensure_custom_type_defined, ExportedTypeDef, ExportedTypeKind}, + component_macro::{CORE_TYPES_PACKAGE, ComponentMethod, MethodReturn, to_kebab_case}, + types::{ExportedTypeDef, ExportedTypeKind, ensure_custom_type_defined}, util::generated_wit_folder, }; diff --git a/sdk/base-macros/src/export_type.rs b/sdk/base-macros/src/export_type.rs index 575313966..70f2a9fc6 100644 --- a/sdk/base-macros/src/export_type.rs +++ b/sdk/base-macros/src/export_type.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, Item}; +use syn::{Item, parse_macro_input}; use crate::types::{exported_type_from_enum, exported_type_from_struct, register_export_type}; diff --git a/sdk/base-macros/src/generate.rs b/sdk/base-macros/src/generate.rs index e0fb3e893..04b15dc0f 100644 --- a/sdk/base-macros/src/generate.rs +++ b/sdk/base-macros/src/generate.rs @@ -1,14 +1,14 @@ use std::{collections::HashMap, env, fs, path::PathBuf}; use proc_macro2::{Span, TokenStream as TokenStream2}; -use quote::{quote, ToTokens}; +use quote::{ToTokens, quote}; use syn::{ + Attribute, Error, File, FnArg, ImplItem, ImplItemFn, Item, ItemFn, ItemImpl, ItemStruct, + LitStr, Pat, ReturnType, Token, TypePath, parse::{Parse, ParseStream}, parse_quote, spanned::Spanned, visit_mut::VisitMut, - Attribute, Error, File, FnArg, ImplItem, ImplItemFn, Item, ItemFn, ItemImpl, ItemStruct, - LitStr, Pat, ReturnType, Token, TypePath, }; use wit_bindgen_core::wit_parser::{PackageId, Resolve, UnresolvedPackageGroup}; use wit_bindgen_rust::{Opts, WithOption}; diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index dbc126498..19197c565 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -2,7 +2,7 @@ use std::{env, fs, path::Path}; use proc_macro2::{Literal, Span}; use quote::quote; -use syn::{parse_macro_input, spanned::Spanned, FnArg, ItemFn, Pat, PatIdent}; +use syn::{FnArg, ItemFn, Pat, PatIdent, parse_macro_input, spanned::Spanned}; use toml::Value; use crate::{ diff --git a/sdk/base-macros/src/types.rs b/sdk/base-macros/src/types.rs index 9951c56cf..4522c4355 100644 --- a/sdk/base-macros/src/types.rs +++ b/sdk/base-macros/src/types.rs @@ -7,7 +7,7 @@ static EXPORTED_TYPES: OnceLock>> = OnceLock::new(); use heck::ToKebabCase; use proc_macro2::Span; -use syn::{spanned::Spanned, ItemStruct, Type}; +use syn::{ItemStruct, Type, spanned::Spanned}; use crate::manifest_paths::SDK_WIT_SOURCE; @@ -178,11 +178,7 @@ fn extract_wit_type_name(line: &str, keyword: &str) -> Option { break; } } - if name.is_empty() { - None - } else { - Some(name) - } + if name.is_empty() { None } else { Some(name) } } pub(crate) fn exported_type_from_struct( diff --git a/sdk/base/src/types/storage.rs b/sdk/base/src/types/storage.rs index 376711b86..695c43ea9 100644 --- a/sdk/base/src/types/storage.rs +++ b/sdk/base/src/types/storage.rs @@ -1,4 +1,4 @@ -use miden_base_sys::bindings::{storage, StorageCommitmentRoot}; +use miden_base_sys::bindings::{StorageCommitmentRoot, storage}; use miden_stdlib_sys::Word; pub trait ValueAccess { diff --git a/sdk/stdlib-sys/src/intrinsics/mod.rs b/sdk/stdlib-sys/src/intrinsics/mod.rs index e7a49b64e..e773b3f1a 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::{assert_eq, Felt}, + felt::{Felt, assert_eq}, word::Word, }; diff --git a/sdk/stdlib-sys/src/lib.rs b/sdk/stdlib-sys/src/lib.rs index 7e2a4681f..f234afdc7 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::{ - advice::emit_falcon_sig_to_stack, assert_eq, Digest, Felt, Word, WordAligned, + Digest, Felt, Word, WordAligned, advice::emit_falcon_sig_to_stack, assert_eq, }; pub use stdlib::*; diff --git a/tests/integration-node/src/local_node/handle.rs b/tests/integration-node/src/local_node/handle.rs index 751c066e2..e97f85b3e 100644 --- a/tests/integration-node/src/local_node/handle.rs +++ b/tests/integration-node/src/local_node/handle.rs @@ -6,13 +6,13 @@ 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, }, - RPC_PORT, }; /// Handle to the shared node instance. When dropped, decrements the reference count. diff --git a/tests/integration-node/src/local_node/mod.rs b/tests/integration-node/src/local_node/mod.rs index c2b628e30..729fe1c91 100644 --- a/tests/integration-node/src/local_node/mod.rs +++ b/tests/integration-node/src/local_node/mod.rs @@ -7,7 +7,7 @@ mod process; mod setup; mod sync; -pub use handle::{ensure_shared_node, SharedNodeHandle}; +pub use handle::{SharedNodeHandle, ensure_shared_node}; // Base directory for all miden test node files const BASE_DIR: &str = "/tmp/miden-test-node"; diff --git a/tests/integration-node/src/local_node/process.rs b/tests/integration-node/src/local_node/process.rs index 43648bc35..8b9ef49fd 100644 --- a/tests/integration-node/src/local_node/process.rs +++ b/tests/integration-node/src/local_node/process.rs @@ -8,9 +8,9 @@ use std::{ time::{Duration, Instant}, }; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; -use super::{data_dir, rpc_url, setup::LocalMidenNode, RPC_PORT}; +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 { diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index a9e8ce019..3086df732 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -5,7 +5,7 @@ use miden_client::{ note::NoteAssets, transaction::{OutputNote, TransactionRequestBuilder}, }; -use miden_core::{utils::Serializable, Felt}; +use miden_core::{Felt, utils::Serializable}; use super::helpers::*; use crate::local_node::ensure_shared_node; diff --git a/tests/integration-node/src/node_tests/counter_contract.rs b/tests/integration-node/src/node_tests/counter_contract.rs index 32e210d42..36c75d1bd 100644 --- a/tests/integration-node/src/node_tests/counter_contract.rs +++ b/tests/integration-node/src/node_tests/counter_contract.rs @@ -1,9 +1,9 @@ //! Counter contract test module use miden_client::{ + Word, account::StorageMap, transaction::{OutputNote, TransactionRequestBuilder}, - Word, }; use miden_core::{Felt, FieldElement}; 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 index bb3ac5aca..cd5f144f3 100644 --- a/tests/integration-node/src/node_tests/counter_contract_no_auth.rs +++ b/tests/integration-node/src/node_tests/counter_contract_no_auth.rs @@ -1,9 +1,9 @@ //! Counter contract test with no-auth authentication component use miden_client::{ + Word, account::StorageMap, transaction::{OutputNote, TransactionRequestBuilder}, - Word, }; use miden_core::{Felt, FieldElement}; 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 index 10ffc65dd..27fa0d9ae 100644 --- a/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs +++ b/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs @@ -5,18 +5,18 @@ //! 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, - Client, DebugMode, Word, }; 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::{rngs::StdRng, RngCore}; +use rand::{RngCore, rngs::StdRng}; use super::helpers::*; use crate::local_node::ensure_shared_node; diff --git a/tests/integration-node/src/node_tests/helpers.rs b/tests/integration-node/src/node_tests/helpers.rs index 93360efc1..a82734357 100644 --- a/tests/integration-node/src/node_tests/helpers.rs +++ b/tests/integration-node/src/node_tests/helpers.rs @@ -3,14 +3,15 @@ use std::{borrow::Borrow, collections::BTreeSet, path::Path, sync::Arc}; use miden_client::{ + Client, ClientError, account::{ - component::{AuthRpoFalcon512, BasicFungibleFaucet, BasicWallet}, Account, AccountId, AccountStorageMode, AccountType, StorageSlot, + component::{AuthRpoFalcon512, BasicFungibleFaucet, BasicWallet}, }, asset::{FungibleAsset, TokenSymbol}, auth::{AuthSecretKey, PublicKeyCommitment}, builder::ClientBuilder, - crypto::{rpo_falcon512::SecretKey, FeltRng, RpoRandomCoin}, + crypto::{FeltRng, RpoRandomCoin, rpo_falcon512::SecretKey}, keystore::FilesystemKeyStore, note::{ Note, NoteExecutionHint, NoteInputs, NoteMetadata, NoteRecipient, NoteScript, NoteTag, @@ -19,7 +20,6 @@ use miden_client::{ rpc::{Endpoint, GrpcClient}, transaction::{TransactionRequestBuilder, TransactionScript}, utils::Deserializable, - Client, ClientError, }; use miden_client_sqlite_store::ClientBuilderSqliteExt; use miden_core::{Felt, FieldElement, Word}; @@ -33,7 +33,7 @@ use miden_objects::{ transaction::TransactionId, }; use midenc_frontend_wasm::WasmTranslationConfig; -use rand::{rngs::StdRng, RngCore}; +use rand::{RngCore, rngs::StdRng}; /// Test setup configuration pub struct TestSetup { diff --git a/tests/integration/src/codegen/intrinsics/mem.rs b/tests/integration/src/codegen/intrinsics/mem.rs index 4778daa31..e6a1d98c6 100644 --- a/tests/integration/src/codegen/intrinsics/mem.rs +++ b/tests/integration/src/codegen/intrinsics/mem.rs @@ -4,8 +4,8 @@ use miden_debug::ToMidenRepr; use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - dialects::builtin::BuiltinOpBuilder, AbiParam, Felt, PointerType, Signature, SourceSpan, Type, - ValueRef, + AbiParam, Felt, PointerType, Signature, SourceSpan, Type, ValueRef, + dialects::builtin::BuiltinOpBuilder, }; use proptest::{ prelude::any, diff --git a/tests/integration/src/codegen/operations.rs b/tests/integration/src/codegen/operations.rs index cde2d11e0..d7f9eb983 100644 --- a/tests/integration/src/codegen/operations.rs +++ b/tests/integration/src/codegen/operations.rs @@ -1,8 +1,8 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_cf::ControlFlowOpBuilder; use midenc_hir::{ - dialects::builtin::BuiltinOpBuilder, AbiParam, Felt, Immediate, Signature, SourceSpan, Type, - ValueRef, + AbiParam, Felt, Immediate, Signature, SourceSpan, Type, ValueRef, + dialects::builtin::BuiltinOpBuilder, }; use crate::testing::{compile_test_module, eval_package}; 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 b2090df8f..30e4f5cbc 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 @@ -1,7 +1,7 @@ use core::panic; use std::{collections::VecDeque, sync::Arc}; -use miden_core::{utils::group_slice_elements, FieldElement, StarkField}; +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; @@ -17,8 +17,8 @@ use proptest::{ }; use crate::{ - testing::{eval_package, Initializer}, CompilerTest, + testing::{Initializer, eval_package}, }; #[test] 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 ede3be339..87d578981 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs @@ -1,7 +1,7 @@ use core::panic; use std::collections::VecDeque; -use miden_core::{utils::group_slice_elements, FieldElement}; +use miden_core::{FieldElement, utils::group_slice_elements}; use miden_debug::{Executor, Felt as TestFelt, ToMidenRepr}; use miden_processor::AdviceInputs; use midenc_expect_test::expect_file; @@ -16,8 +16,8 @@ use proptest::{ }; use crate::{ - testing::{eval_package, Initializer}, CompilerTest, + testing::{Initializer, eval_package}, }; #[test] 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 ab58a9b7a..cf35983a7 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 @@ -7,7 +7,7 @@ use miden_lib::MidenLib; use miden_processor::ExecutionError; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; -use midenc_session::{diagnostics::Report, Emit, STDLIB}; +use midenc_session::{Emit, STDLIB, diagnostics::Report}; use crate::CompilerTestBuilder; diff --git a/tests/integration/src/rust_masm_tests/examples.rs b/tests/integration/src/rust_masm_tests/examples.rs index 6d990e411..e45c0116e 100644 --- a/tests/integration/src/rust_masm_tests/examples.rs +++ b/tests/integration/src/rust_masm_tests/examples.rs @@ -8,13 +8,13 @@ use miden_objects::account::AccountComponentMetadata; use midenc_expect_test::{expect, expect_file}; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::{ - interner::Symbol, Felt, FunctionIdent, Ident, Immediate, Op, SourceSpan, SymbolTable, + Felt, FunctionIdent, Ident, Immediate, Op, SourceSpan, SymbolTable, interner::Symbol, }; use midenc_session::STDLIB; use prop::test_runner::{Config, TestRunner}; use proptest::prelude::*; -use crate::{cargo_proj::project, CompilerTest, CompilerTestBuilder}; +use crate::{CompilerTest, CompilerTestBuilder, cargo_proj::project}; #[test] fn storage_example() { diff --git a/tests/integration/src/rust_masm_tests/instructions.rs b/tests/integration/src/rust_masm_tests/instructions.rs index 8efdcd509..e81d94fa5 100644 --- a/tests/integration/src/rust_masm_tests/instructions.rs +++ b/tests/integration/src/rust_masm_tests/instructions.rs @@ -10,8 +10,8 @@ use proptest::{ use super::run_masm_vs_rust; use crate::{ - testing::{eval_package, Initializer}, CompilerTest, + testing::{Initializer, eval_package}, }; macro_rules! test_bin_op { diff --git a/tests/integration/src/rust_masm_tests/intrinsics.rs b/tests/integration/src/rust_masm_tests/intrinsics.rs index 0f3899974..bac3d51cd 100644 --- a/tests/integration/src/rust_masm_tests/intrinsics.rs +++ b/tests/integration/src/rust_masm_tests/intrinsics.rs @@ -9,7 +9,7 @@ use proptest::{ test_runner::{TestError, TestRunner}, }; -use crate::{rust_masm_tests::run_masm_vs_rust, CompilerTest}; +use crate::{CompilerTest, rust_masm_tests::run_masm_vs_rust}; /// Compiles, runs VM vs. Rust fuzzing the inputs via proptest macro_rules! test_bin_op { 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 d2beed746..7f2f13985 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 @@ -1,8 +1,8 @@ use std::sync::Arc; use miden_core::{ - crypto::merkle::{MerkleStore, Smt}, Felt, FieldElement, Word, + crypto::merkle::{MerkleStore, Smt}, }; use miden_debug::Executor; use miden_lib::MidenLib; 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 099a3e6df..60d875e2c 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 @@ -9,8 +9,8 @@ use proptest::{ use sha2::{Digest, Sha256}; use crate::{ - testing::{eval_package, Initializer}, CompilerTest, + testing::{Initializer, eval_package}, }; /// Runs the provided stdlib hash function against random 32-byte inputs and compares the outputs diff --git a/tests/integration/src/testing/eval.rs b/tests/integration/src/testing/eval.rs index 1b2ef43fa..9ddfeb387 100644 --- a/tests/integration/src/testing/eval.rs +++ b/tests/integration/src/testing/eval.rs @@ -5,7 +5,7 @@ use miden_debug::{ExecutionTrace, Executor, FromMidenRepr}; use miden_lib::MidenLib; use miden_processor::AdviceInputs; use midenc_compile::LinkOutput; -use midenc_session::{Session, STDLIB}; +use midenc_session::{STDLIB, Session}; use proptest::test_runner::TestCaseError; use super::*; @@ -150,7 +150,7 @@ pub fn compile_test_module( pub fn compile_link_output_to_package( link_output: LinkOutput, ) -> Result { - use midenc_compile::{compile_link_output_to_masm_with_pre_assembly_stage, CodegenOutput}; + use midenc_compile::{CodegenOutput, compile_link_output_to_masm_with_pre_assembly_stage}; // Compile to Package let mut pre_assembly_stage = |output: CodegenOutput, _context| { diff --git a/tests/integration/src/testing/setup.rs b/tests/integration/src/testing/setup.rs index 7db6c754d..6725c508c 100644 --- a/tests/integration/src/testing/setup.rs +++ b/tests/integration/src/testing/setup.rs @@ -3,11 +3,11 @@ use std::{path::PathBuf, rc::Rc}; use midenc_compile::LinkOutput; use midenc_hir::{ + BuilderExt, Context, Ident, Op, OpBuilder, Signature, SourceSpan, dialects::builtin::{ self, ComponentBuilder, FunctionBuilder, FunctionRef, ModuleBuilder, WorldBuilder, }, version::Version, - BuilderExt, Context, Ident, Op, OpBuilder, Signature, SourceSpan, }; use midenc_session::{InputFile, Session}; diff --git a/tools/cargo-miden/src/compile_masm.rs b/tools/cargo-miden/src/compile_masm.rs index 6e2c7469c..72bb3d912 100644 --- a/tools/cargo-miden/src/compile_masm.rs +++ b/tools/cargo-miden/src/compile_masm.rs @@ -5,8 +5,8 @@ use std::{ use midenc_compile::{Compiler, Context}; use midenc_session::{ - diagnostics::{IntoDiagnostic, Report, WrapErr}, InputFile, OutputType, + diagnostics::{IntoDiagnostic, Report, WrapErr}, }; pub fn wasm_to_masm( diff --git a/tools/cargo-miden/src/config.rs b/tools/cargo-miden/src/config.rs index b0206ef33..b552aebc9 100644 --- a/tools/cargo-miden/src/config.rs +++ b/tools/cargo-miden/src/config.rs @@ -2,7 +2,7 @@ use std::{fmt, str::FromStr}; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use semver::Version; /// Represents a cargo package specifier. diff --git a/tools/cargo-miden/src/dependencies.rs b/tools/cargo-miden/src/dependencies.rs index afdc295d5..f21b66112 100644 --- a/tools/cargo-miden/src/dependencies.rs +++ b/tools/cargo-miden/src/dependencies.rs @@ -4,11 +4,11 @@ use std::{ path::PathBuf, }; -use anyhow::{anyhow, bail, Context, Result}; -use cargo_metadata::{camino, Package}; +use anyhow::{Context, Result, anyhow, bail}; +use cargo_metadata::{Package, camino}; use serde::Deserialize; -use crate::{commands::CargoOptions, BuildOutput, OutputType}; +use crate::{BuildOutput, OutputType, commands::CargoOptions}; /// Defines dependency (the rhs of the dependency `"ns:package" = { path = "..." }` pair) #[derive(Deserialize, Debug, Clone)] diff --git a/tools/cargo-miden/src/main.rs b/tools/cargo-miden/src/main.rs index 269b47db8..7048c7f85 100644 --- a/tools/cargo-miden/src/main.rs +++ b/tools/cargo-miden/src/main.rs @@ -1,5 +1,5 @@ use anyhow::Ok; -use cargo_miden::{run, OutputType}; +use cargo_miden::{OutputType, run}; fn main() -> anyhow::Result<()> { // Initialize logger diff --git a/tools/cargo-miden/src/target.rs b/tools/cargo-miden/src/target.rs index ba5ec33ff..f1666149f 100644 --- a/tools/cargo-miden/src/target.rs +++ b/tools/cargo-miden/src/target.rs @@ -4,7 +4,7 @@ use std::{ process::{Command, Stdio}, }; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use cargo_metadata::Package; use midenc_session::{ProjectType, RollupTarget, TargetEnv}; diff --git a/tools/cargo-miden/src/template.rs b/tools/cargo-miden/src/template.rs index 2a1e7ec97..02fc921fb 100644 --- a/tools/cargo-miden/src/template.rs +++ b/tools/cargo-miden/src/template.rs @@ -5,8 +5,8 @@ use std::{ process::{Command, Stdio}, }; -use anyhow::{bail, Context, Result}; -use liquid::{model::Value, Object, Parser}; +use anyhow::{Context, Result, bail}; +use liquid::{Object, Parser, model::Value}; use tempfile::TempDir; use toml_edit::DocumentMut; use walkdir::WalkDir; From 421e72a99d77d29bd917498fe7587aa50a6177a7 Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Mon, 15 Dec 2025 14:26:28 -0500 Subject: [PATCH 61/70] chore: bump rust-templates to v0.23.0 --- tools/cargo-miden/src/commands/new_project.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index cab73cf56..a973a690a 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -13,7 +13,7 @@ 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 TEMPLATES_REPO_TAG: &str = "v0.22.0"; +const TEMPLATES_REPO_TAG: &str = "v0.23.0"; // This should have been an enum but I could not bend `clap` to expose variants as flags /// Project template From 758db09d3fa3d5cc2ddf66e8cb505bc793a22677 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 16 Dec 2025 09:11:10 +0200 Subject: [PATCH 62/70] fix: use git tag for new Miden project template (`cargo miden new`) --- tools/cargo-miden/src/commands/new_project.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index a973a690a..3a4b46155 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -9,11 +9,17 @@ use toml_edit::{DocumentMut, Item, Value}; use crate::template::{GenerateArgs, TemplatePath, generate}; -/// The tag used in checkout of the new project template. +/// The tag used in checkout of the new contract project template (`cargo miden new --account `, `--note`, etc) . /// /// Before changing it make sure the new tag exists in the rust-templates repo and points to the /// desired commit. -const TEMPLATES_REPO_TAG: &str = "v0.23.0"; +const PROJECT_TEMPLATES_REPO_TAG: &str = "v0.23.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.6"; // This should have been an enum but I could not bend `clap` to expose variants as flags /// Project template @@ -187,13 +193,13 @@ impl NewCommand { None => match self.template.as_ref() { Some(project_template) => TemplatePath { git: Some("https://github.com/0xMiden/rust-templates".into()), - tag: Some(TEMPLATES_REPO_TAG.into()), + tag: Some(PROJECT_TEMPLATES_REPO_TAG.into()), auto_path: Some(project_template.to_string()), ..Default::default() }, None => TemplatePath { git: Some("https://github.com/0xMiden/project-template".into()), - tag: None, + tag: Some(MIDEN_PROJECT_TEMPLATE_REPO_TAG.into()), ..Default::default() }, }, From f33b6cf47055ea1933625774bf0d3ee5ccc3c662 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 17 Dec 2025 15:59:10 +0200 Subject: [PATCH 63/70] fix: remove sorting the targets in `br_table` Wasm op translation --- frontend/wasm/src/code_translator/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/wasm/src/code_translator/mod.rs b/frontend/wasm/src/code_translator/mod.rs index c3a8a40e9..e83d3243e 100644 --- a/frontend/wasm/src/code_translator/mod.rs +++ b/frontend/wasm/src/code_translator/mod.rs @@ -910,7 +910,6 @@ fn translate_br_table( targets.push(depth); } - targets.sort(); let default_depth = br_targets.default(); let min_depth = From 49f55acc94e5e2f3867e0b5325a634aef14f268a Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 16 Dec 2025 15:09:58 +0200 Subject: [PATCH 64/70] feature(SDK): add `Recipient::compute(serial_num: Word, script_digest: Digest, padded_inputs: Vec) -> Self` as a Rust equivalent for the tx kernel `miden::note::build_recipient_hash` MASM procedure --- sdk/base-sys/src/bindings/types.rs | 31 ++++- .../abi_transform/tx_kernel.rs | 119 +++++++++++++++++- 2 files changed, 143 insertions(+), 7 deletions(-) diff --git a/sdk/base-sys/src/bindings/types.rs b/sdk/base-sys/src/bindings/types.rs index aa256d13a..ce3898c6a 100644 --- a/sdk/base-sys/src/bindings/types.rs +++ b/sdk/base-sys/src/bindings/types.rs @@ -1,4 +1,8 @@ -use miden_stdlib_sys::{Felt, Word}; +extern crate alloc; + +use alloc::vec::Vec; + +use miden_stdlib_sys::{felt, hash_elements, intrinsics::crypto::merge, Digest, Felt, Word}; #[allow(unused)] #[derive(Copy, Clone, Debug, PartialEq, Eq)] @@ -67,6 +71,31 @@ pub struct Recipient { pub inner: Word, } +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)]`. + /// + /// # 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)]); + + 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(); + + Self { inner: digest } + } +} + impl From<[Felt; 4]> for Recipient { fn from(value: [Felt; 4]) -> Self { Recipient { 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 cf35983a7..c2fa19b3e 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 @@ -1,15 +1,18 @@ -use std::{fmt::Write, sync::Arc}; +use std::sync::Arc; -use miden_assembly::LibraryPath; -use miden_core::{Felt, FieldElement}; -use miden_debug::Executor; +use miden_assembly::Assembler; +use miden_core::Felt; +use miden_debug::{Executor, Felt as TestFelt}; use miden_lib::MidenLib; -use miden_processor::ExecutionError; +use miden_objects::note::{NoteInputs, NoteRecipient, NoteScript}; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_session::{Emit, STDLIB, diagnostics::Report}; -use crate::CompilerTestBuilder; +use crate::{ + CompilerTestBuilder, + testing::{Initializer, eval_package}, +}; #[allow(unused)] fn setup_log() { @@ -82,6 +85,110 @@ end Ok(()) } +#[test] +fn test_recipient_compute_matches_note_recipient_digest() -> Result<(), Report> { + let note_script_program = Assembler::default() + .assemble_program( + r#" +begin + push.1 + drop +end +"#, + ) + .expect("failed to assemble note script program"); + let note_script = NoteScript::new(note_script_program); + + let serial_num = + miden_core::Word::new([Felt::new(1), Felt::new(2), Felt::new(3), Felt::new(4)]); + let input1 = Felt::new(5); + let input2 = Felt::new(6); + let inputs = NoteInputs::new(vec![input1, input2]).expect("invalid note inputs"); + 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); + recipient.inner + }"# + .to_string(); + + let config = WasmTranslationConfig::default(); + let mut test = CompilerTestBuilder::rust_fn_body_with_sdk( + "abi_transform_tx_kernel_recipient_compute", + &main_fn, + config, + ["--test-harness".into()], + ) + .build(); + + 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 script_root: miden_core::Word = note_script.root(); + + // The Rust extern "C" ABI for this entrypoint uses byval pointers for the `Word`, `Digest`, + // and `Vec` arguments. We initialize all three arguments in a single contiguous payload and + // pass their byte pointers as inputs. The return value is written to an output buffer, whose + // pointer is passed as the final argument (see `test_adv_load_preimage` for similar patterns). + let base_addr = 20u32 * 65536; // 1310720 + let serial_num_ptr = base_addr; + let script_digest_ptr = base_addr + 16; + let vec_ptr = base_addr + 32; + let vec_data_ptr = base_addr + 48; + + let out_addr = 21u32 * 65536; + + let serial_num_felts: [Felt; 4] = serial_num.into(); + let script_digest_felts: [Felt; 4] = script_root.into(); + + let mut init_felts = Vec::new(); + 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(vec_data_ptr), + Felt::from(padded_inputs.len() as u32), + Felt::new(0), + ]); + init_felts.extend_from_slice(&padded_inputs); + + let initializers = [Initializer::MemoryFelts { + addr: base_addr / 4, + felts: (&init_felts).into(), + }]; + + let args = [ + Felt::new(vec_ptr as u64), + Felt::new(script_digest_ptr as u64), + Felt::new(serial_num_ptr as u64), + Felt::new(out_addr as u64), + ]; + + let _ = eval_package::(&package, initializers, &args, &test.session, |trace| { + let actual: [TestFelt; 4] = + trace.read_from_rust_memory(out_addr).expect("expected output to be written"); + let expected: [Felt; 4] = expected_digest.into(); + assert_eq!( + [actual[0].0, actual[1].0, actual[2].0, actual[3].0], + expected, + "recipient digest mismatch" + ); + Ok(()) + }) + .map_err(|err| Report::msg(err.to_string()))?; + Ok(()) +} + #[test] fn test_get_id() { let main_fn = "() -> AccountId { miden::active_account::get_id() }"; From a1e470d573bd12cba3a7f56e2bab2a94849c8a6a Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 17 Dec 2025 17:02:47 +0200 Subject: [PATCH 65/70] chore: update expected files and code format after rebase --- sdk/base-sys/src/bindings/types.rs | 2 +- .../abi_transform_tx_kernel_get_inputs_4.hir | 1392 +++++++-------- .../abi_transform_tx_kernel_get_inputs_4.masm | 35 +- .../abi_transform_tx_kernel_get_inputs_4.wat | 47 +- .../examples/basic_wallet_tx_script.hir | 1456 +++++++-------- .../examples/basic_wallet_tx_script.masm | 37 +- .../examples/basic_wallet_tx_script.wat | 72 +- tests/integration/expected/examples/p2id.hir | 1564 +++++++++-------- tests/integration/expected/examples/p2id.masm | 35 +- tests/integration/expected/examples/p2id.wat | 45 +- 10 files changed, 2415 insertions(+), 2270 deletions(-) diff --git a/sdk/base-sys/src/bindings/types.rs b/sdk/base-sys/src/bindings/types.rs index ce3898c6a..739b24403 100644 --- a/sdk/base-sys/src/bindings/types.rs +++ b/sdk/base-sys/src/bindings/types.rs @@ -2,7 +2,7 @@ extern crate alloc; use alloc::vec::Vec; -use miden_stdlib_sys::{felt, hash_elements, intrinsics::crypto::merge, Digest, Felt, Word}; +use miden_stdlib_sys::{Digest, Felt, Word, felt, hash_elements, intrinsics::crypto::merge}; #[allow(unused)] #[derive(Copy, Clone, Debug, PartialEq, Eq)] 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 index 29a16018b..c67b09edc 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir @@ -16,33 +16,33 @@ builtin.component root_ns:root@1.0.0 { ^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 - v732 = arith.constant 0 : 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, v732 : i1; + v20 = arith.neq v18, v736 : i1; scf.if v20{ ^block10: scf.yield ; } else { ^block11: - v731 = arith.constant 0 : i32; + 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, v731 : i1; + v27 = arith.neq v25, v735 : i1; v28 = cf.select v27, v11, v9 : i32; - v729 = arith.constant 0 : i32; - v730 = arith.constant 0 : i32; - v30 = arith.eq v28, v730 : i1; + 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, v729 : i1; + v34 = arith.neq v32, v733 : i1; scf.if v34{ - ^block109: + ^block113: scf.yield ; } else { ^block12: @@ -63,33 +63,33 @@ builtin.component root_ns:root@1.0.0 { ^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 - v741 = arith.constant 0 : 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, v741 : i1; + v51 = arith.neq v49, v745 : i1; scf.if v51{ ^block15: scf.yield ; } else { ^block16: - v739 = arith.constant 0 : i32; - v740 = arith.constant 0 : i32; - v53 = arith.eq v41, v740 : i1; + 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, v739 : i1; + v57 = arith.neq v55, v743 : i1; scf.if v57{ - ^block112: + ^block116: scf.yield ; } else { ^block17: - v733 = arith.constant 0 : u8; + 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, v733; + hir.mem_set v62, v60, v737; scf.yield ; }; scf.yield ; @@ -119,133 +119,135 @@ builtin.component root_ns:root@1.0.0 { 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 - v777 = arith.constant 4 : i32; - v83 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v777) : 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) - v776 = arith.constant 0 : i32; + 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, v776 : i1; - v747 = scf.if v89 : u32 { - ^block118: - v743 = arith.constant 0 : u32; - scf.yield v743; + 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]; - v775 = arith.constant 4 : u32; - v94 = arith.mod v92, v775 : u32; + 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; - v774 = arith.constant 4 : u32; - v99 = arith.mod v97, v774 : 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) - v773 = arith.constant 0 : i32; + 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, v773 : i1; - v749 = scf.if v109 : u32 { - ^block117: - v772 = arith.constant 0 : u32; - scf.yield v772; + v109 = arith.neq v107, v777 : i1; + v753 = scf.if v109 : u32 { + ^block121: + v776 = arith.constant 0 : u32; + scf.yield v776; } else { ^block22: - v771 = arith.constant 4 : u32; + v775 = arith.constant 4 : u32; v110 = hir.bitcast v96 : u32; - v112 = arith.add v110, v771 : u32 #[overflow = checked]; - v770 = arith.constant 4 : u32; - v114 = arith.mod v112, v770 : 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; - v769 = arith.constant 1 : i32; - v118 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v769) : 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) - v768 = arith.constant 0 : i32; - v742 = arith.constant 2 : u32; + v772 = arith.constant 0 : i32; + v746 = arith.constant 2 : u32; v120 = hir.bitcast v80 : u32; - v122 = arith.lte v120, v742 : i1; + v122 = arith.lte v120, v746 : i1; v123 = arith.zext v122 : u32; v124 = hir.bitcast v123 : i32; - v126 = arith.neq v124, v768 : i1; - v751 = scf.if v126 : u32 { - ^block116: - v767 = arith.constant 0 : u32; - scf.yield v767; + v126 = arith.neq v124, v772 : i1; + v755 = scf.if v126 : u32 { + ^block120: + v771 = arith.constant 0 : u32; + scf.yield v771; } else { ^block23: - v766 = arith.constant 8 : u32; + v770 = arith.constant 8 : u32; v127 = hir.bitcast v96 : u32; - v129 = arith.add v127, v766 : u32 #[overflow = checked]; - v765 = arith.constant 4 : u32; - v131 = arith.mod v129, v765 : 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) - v764 = arith.constant 0 : i32; + 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, v764 : i1; + v141 = arith.neq v139, v768 : i1; scf.if v141{ - ^block115: + ^block119: scf.yield ; } else { ^block24: - v763 = arith.constant 12 : u32; + v767 = arith.constant 12 : u32; v142 = hir.bitcast v96 : u32; - v144 = arith.add v142, v763 : u32 #[overflow = checked]; - v762 = arith.constant 4 : u32; - v146 = arith.mod v144, v762 : 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; - v761 = arith.constant 3 : i32; - v150 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v761) : 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) - v759 = arith.constant 4 : i32; - v760 = arith.constant 4 : i32; - v152 = arith.add v69, v760 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v152, v759, v759) - v758 = arith.constant 16 : i32; - v156 = arith.add v69, v758 : i32 #[overflow = wrapping]; + 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 ; }; - v745 = arith.constant 1 : u32; - v757 = arith.constant 0 : u32; - v755 = cf.select v141, v757, v745 : u32; - scf.yield v755; + v749 = arith.constant 1 : u32; + v761 = arith.constant 0 : u32; + v759 = cf.select v141, v761, v749 : u32; + scf.yield v759; }; - scf.yield v751; + scf.yield v755; }; - scf.yield v749; + scf.yield v753; }; - v756 = arith.constant 0 : u32; - v754 = arith.eq v747, v756 : i1; - cf.cond_br v754 ^block20, ^block120; + v760 = arith.constant 0 : u32; + v758 = arith.eq v751, v760 : i1; + cf.cond_br v758 ^block20, ^block124; ^block20: ub.unreachable ; - ^block120: + ^block124: builtin.ret ; }; @@ -258,27 +260,27 @@ builtin.component root_ns:root@1.0.0 { ^block27(v159: i32, v160: i32, v161: i32): v164 = arith.constant 16 : i32; v163 = arith.constant 0 : i32; - v779 = arith.constant 16 : u32; + v783 = arith.constant 16 : u32; v166 = hir.bitcast v160 : u32; - v168 = arith.gt v166, v779 : i1; + 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; - v819 = arith.constant 0 : 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, v819 : i1; - v788, v789 = scf.if v178 : i32, u32 { - ^block127: - v780 = arith.constant 0 : u32; - v784 = ub.poison i32 : i32; - scf.yield v784, v780; + 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 - v818 = arith.constant 0 : i32; + v822 = arith.constant 0 : i32; v179 = arith.constant -2147483648 : i32; v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; v183 = hir.bitcast v181 : u32; @@ -286,18 +288,18 @@ builtin.component root_ns:root@1.0.0 { v184 = arith.gt v182, v183 : i1; v185 = arith.zext v184 : u32; v186 = hir.bitcast v185 : i32; - v188 = arith.neq v186, v818 : i1; - v803 = scf.if v188 : i32 { - ^block126: - v817 = ub.poison i32 : i32; - scf.yield v817; + v188 = arith.neq v186, v822 : i1; + v807 = scf.if v188 : i32 { + ^block130: + v821 = ub.poison i32 : i32; + scf.yield v821; } else { ^block31: - v815 = arith.constant 0 : i32; - v194 = arith.sub v815, v180 : i32 #[overflow = wrapping]; - v816 = arith.constant -1 : i32; + 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, v816 : 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; @@ -305,51 +307,51 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v198 #[code = 250]; v199 = hir.int_to_ptr v196 : ptr; v200 = hir.load v199 : i32; - v814 = arith.constant 0 : i32; - v202 = arith.neq v200, v814 : i1; + v818 = arith.constant 0 : i32; + v202 = arith.neq v200, v818 : i1; scf.if v202{ - ^block125: + ^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; - v813 = arith.constant 4 : u32; - v212 = arith.mod v210, v813 : u32; + v817 = arith.constant 4 : u32; + v212 = arith.mod v210, v817 : u32; hir.assertz v212 #[code = 250]; - v812 = arith.constant 16 : u32; + v816 = arith.constant 16 : u32; v205 = hir.bitcast v204 : i32; - v208 = arith.shl v205, v812 : 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; - v811 = arith.constant 4 : u32; - v218 = arith.mod v216, v811 : 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; - v809 = arith.constant 0 : i32; - v810 = arith.constant -1 : i32; - v222 = arith.bxor v220, v810 : 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, v809 : i1; - v802 = scf.if v229 : i32 { + v229 = arith.neq v227, v813 : i1; + v806 = scf.if v229 : i32 { ^block34: - v808 = arith.constant 0 : i32; - scf.yield v808; + v812 = arith.constant 0 : i32; + scf.yield v812; } else { ^block35: v231 = hir.bitcast v159 : u32; - v807 = arith.constant 4 : u32; - v233 = arith.mod v231, v807 : 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; @@ -357,20 +359,20 @@ builtin.component root_ns:root@1.0.0 { v236 = arith.add v220, v180 : i32 #[overflow = wrapping]; scf.yield v236; }; - scf.yield v802; + scf.yield v806; }; - v785 = arith.constant 1 : u32; - v806 = arith.constant 0 : u32; - v804 = cf.select v188, v806, v785 : u32; - scf.yield v803, v804; + v789 = arith.constant 1 : u32; + v810 = arith.constant 0 : u32; + v808 = cf.select v188, v810, v789 : u32; + scf.yield v807, v808; }; - v805 = arith.constant 0 : u32; - v801 = arith.eq v789, v805 : i1; - cf.cond_br v801 ^block29, ^block129(v788); + v809 = arith.constant 0 : u32; + v805 = arith.eq v793, v809 : i1; + cf.cond_br v805 ^block29, ^block133(v792); ^block29: ub.unreachable ; - ^block129(v781: i32): - builtin.ret v781; + ^block133(v785: i32): + builtin.ret v785; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -402,56 +404,56 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v260 #[code = 250]; v261 = hir.int_to_ptr v258 : ptr; v262 = hir.load v261 : i32; - v830 = arith.constant 4 : u32; + v834 = arith.constant 4 : u32; v263 = hir.bitcast v249 : u32; - v265 = arith.add v263, v830 : u32 #[overflow = checked]; - v829 = arith.constant 4 : u32; - v267 = arith.mod v265, v829 : 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; - v828 = arith.constant 0 : 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, v828 : i1; + 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]; - v827 = arith.constant 4 : u32; - v287 = arith.mod v285, v827 : u32; + 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; - v826 = arith.constant 4 : u32; + v830 = arith.constant 4 : u32; v290 = hir.bitcast v241 : u32; - v292 = arith.add v290, v826 : u32 #[overflow = checked]; - v825 = arith.constant 4 : u32; - v294 = arith.mod v292, v825 : 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; - v824 = arith.constant 4 : u32; - v298 = arith.mod v296, v824 : 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; - v823 = arith.constant 16 : i32; - v301 = arith.add v249, v823 : i32 #[overflow = wrapping]; + 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: - v822 = arith.constant 12 : u32; + v826 = arith.constant 12 : u32; v276 = hir.bitcast v249 : u32; - v278 = arith.add v276, v822 : u32 #[overflow = checked]; - v821 = arith.constant 4 : u32; - v280 = arith.mod v278, v821 : 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; @@ -459,638 +461,650 @@ builtin.component root_ns:root@1.0.0 { ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v304: i32) { + private builtin.function @ as core::ops::drop::Drop>::drop(v304: i32) { ^block44(v304: i32): - v306 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v307 = hir.bitcast v306 : ptr; - v308 = hir.load v307 : i32; - v309 = arith.constant 16 : i32; - v310 = arith.sub v308, v309 : i32 #[overflow = wrapping]; - v311 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v312 = hir.bitcast v311 : ptr; - hir.store v312, v310; - v315 = arith.constant 4 : i32; - v313 = arith.constant 8 : i32; - v314 = arith.add v310, v313 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::with_capacity_in(v314, v315, v315) - v318 = arith.constant 8 : u32; - v317 = hir.bitcast v310 : u32; - v319 = arith.add v317, v318 : u32 #[overflow = checked]; - v320 = arith.constant 4 : u32; - v321 = arith.mod v319, v320 : u32; - hir.assertz v321 #[code = 250]; - v322 = hir.int_to_ptr v319 : ptr; - v323 = hir.load v322 : i32; - v325 = arith.constant 12 : u32; - v324 = hir.bitcast v310 : u32; - v326 = arith.add v324, v325 : u32 #[overflow = checked]; - v838 = arith.constant 4 : u32; - v328 = arith.mod v326, v838 : u32; - hir.assertz v328 #[code = 250]; - v329 = hir.int_to_ptr v326 : ptr; - v330 = hir.load v329 : i32; - v831 = arith.constant 2 : u32; - v332 = hir.bitcast v330 : u32; - v334 = arith.shr v332, v831 : u32; - v335 = hir.bitcast v334 : i32; - v336 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::active_note::get_inputs(v335) : i32 - v837 = arith.constant 8 : u32; - v337 = hir.bitcast v304 : u32; - v339 = arith.add v337, v837 : u32 #[overflow = checked]; - v836 = arith.constant 4 : u32; - v341 = arith.mod v339, v836 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v336; - v835 = arith.constant 4 : u32; - v343 = hir.bitcast v304 : u32; - v345 = arith.add v343, v835 : u32 #[overflow = checked]; - v834 = arith.constant 4 : u32; - v347 = arith.mod v345, v834 : u32; - hir.assertz v347 #[code = 250]; - v348 = hir.int_to_ptr v345 : ptr; - hir.store v348, v330; - v349 = hir.bitcast v304 : u32; - v833 = arith.constant 4 : u32; - v351 = arith.mod v349, v833 : u32; - hir.assertz v351 #[code = 250]; - v352 = hir.int_to_ptr v349 : ptr; - hir.store v352, v323; - v832 = arith.constant 16 : i32; - v354 = arith.add v310, v832 : i32 #[overflow = wrapping]; - v355 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v356 = hir.bitcast v355 : ptr; - hir.store v356, v354; + 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 @>::from(v357: i32) -> felt { - ^block46(v357: i32): - v359 = hir.bitcast v357 : felt; - builtin.ret v359; + 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 @intrinsics::felt::assert_eq(v360: felt, v361: felt) { - ^block48(v360: felt, v361: felt): - hir.assert_eq v360, v361; + private builtin.function @ as core::ops::drop::Drop>::drop(v360: i32) { + ^block48(v360: i32): builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v362: i32) -> felt { - ^block50(v362: i32): - v363 = hir.bitcast v362 : felt; + private builtin.function @>::from(v361: i32) -> felt { + ^block50(v361: i32): + v363 = hir.bitcast v361 : felt; builtin.ret v363; }; - private builtin.function @::alloc_impl(v365: i32, v366: i32, v367: i32, v368: i32) { - ^block52(v365: i32, v366: i32, v367: i32, v368: i32): - v854 = arith.constant 0 : i32; - v369 = arith.constant 0 : i32; - v370 = arith.eq v367, v369 : i1; - v371 = arith.zext v370 : u32; - v372 = hir.bitcast v371 : i32; - v374 = arith.neq v372, v854 : i1; - v850 = scf.if v374 : i32 { - ^block135: - scf.yield v366; + 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 { - ^block55: + ^block59: hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v853 = arith.constant 0 : i32; - v376 = arith.neq v368, v853 : i1; - v849 = scf.if v376 : i32 { - ^block56: - v378 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v367, v366) : i32 - scf.yield v378; + 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 { - ^block57: - v377 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v367, v366) : i32 - scf.yield v377; + ^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 v849; + scf.yield v853; }; - v382 = arith.constant 4 : u32; - v381 = hir.bitcast v365 : u32; - v383 = arith.add v381, v382 : u32 #[overflow = checked]; - v852 = arith.constant 4 : u32; - v385 = arith.mod v383, v852 : u32; - hir.assertz v385 #[code = 250]; - v386 = hir.int_to_ptr v383 : ptr; - hir.store v386, v367; - v388 = hir.bitcast v365 : u32; - v851 = arith.constant 4 : u32; - v390 = arith.mod v388, v851 : u32; - hir.assertz v390 #[code = 250]; - v391 = hir.int_to_ptr v388 : ptr; - hir.store v391, v850; + 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(v392: i32, v393: i32, v394: i32) { - ^block58(v392: i32, v393: i32, v394: i32): - v396 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v397 = hir.bitcast v396 : ptr; - v398 = hir.load v397 : i32; - v399 = arith.constant 16 : i32; - v400 = arith.sub v398, v399 : i32 #[overflow = wrapping]; - v401 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v402 = hir.bitcast v401 : ptr; - hir.store v402, v400; - v403 = arith.constant 4 : i32; - v404 = arith.add v400, v403 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::current_memory(v404, v392, v393, v394) - v406 = arith.constant 8 : u32; - v405 = hir.bitcast v400 : u32; - v407 = arith.add v405, v406 : u32 #[overflow = checked]; - v408 = arith.constant 4 : u32; - v409 = arith.mod v407, v408 : u32; - hir.assertz v409 #[code = 250]; - v410 = hir.int_to_ptr v407 : ptr; - v411 = hir.load v410 : i32; - v861 = arith.constant 0 : i32; - v395 = arith.constant 0 : i32; - v413 = arith.eq v411, v395 : i1; - v414 = arith.zext v413 : u32; - v415 = hir.bitcast v414 : i32; - v417 = arith.neq v415, v861 : i1; - scf.if v417{ - ^block138: + 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 { - ^block61: - v860 = arith.constant 4 : u32; - v418 = hir.bitcast v400 : u32; - v420 = arith.add v418, v860 : u32 #[overflow = checked]; - v859 = arith.constant 4 : u32; - v422 = arith.mod v420, v859 : u32; - hir.assertz v422 #[code = 250]; - v423 = hir.int_to_ptr v420 : ptr; - v424 = hir.load v423 : i32; - v426 = arith.constant 12 : u32; - v425 = hir.bitcast v400 : u32; - v427 = arith.add v425, v426 : u32 #[overflow = checked]; - v858 = arith.constant 4 : u32; - v429 = arith.mod v427, v858 : u32; - hir.assertz v429 #[code = 250]; - v430 = hir.int_to_ptr v427 : ptr; - v431 = hir.load v430 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v424, v411, v431) + ^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 ; }; - v857 = arith.constant 16 : i32; - v434 = arith.add v400, v857 : i32 #[overflow = wrapping]; - v435 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v436 = hir.bitcast v435 : ptr; - hir.store v436, v434; + 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(v437: i32, v438: i32, v439: i32, v440: i32) { - ^block62(v437: i32, v438: i32, v439: i32, v440: i32): - v887 = arith.constant 0 : i32; - v441 = arith.constant 0 : i32; - v445 = arith.eq v440, v441 : i1; - v446 = arith.zext v445 : u32; - v447 = hir.bitcast v446 : i32; - v449 = arith.neq v447, v887 : i1; - v874, v875 = scf.if v449 : i32, i32 { - ^block141: - v886 = arith.constant 0 : i32; - v443 = arith.constant 4 : i32; - scf.yield v443, v886; + 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 { - ^block65: - v450 = hir.bitcast v438 : u32; - v485 = arith.constant 4 : u32; - v452 = arith.mod v450, v485 : u32; - hir.assertz v452 #[code = 250]; - v453 = hir.int_to_ptr v450 : ptr; - v454 = hir.load v453 : i32; - v884 = arith.constant 0 : i32; - v885 = arith.constant 0 : i32; - v456 = arith.eq v454, v885 : i1; - v457 = arith.zext v456 : u32; - v458 = hir.bitcast v457 : i32; - v460 = arith.neq v458, v884 : i1; - v872 = scf.if v460 : i32 { - ^block140: - v883 = arith.constant 0 : i32; - scf.yield v883; + ^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 { - ^block66: + ^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; - v461 = hir.bitcast v437 : u32; - v463 = arith.add v461, v882 : u32 #[overflow = checked]; - v881 = arith.constant 4 : u32; - v465 = arith.mod v463, v881 : u32; - hir.assertz v465 #[code = 250]; - v466 = hir.int_to_ptr v463 : ptr; - hir.store v466, v439; - v880 = arith.constant 4 : u32; - v467 = hir.bitcast v438 : u32; - v469 = arith.add v467, v880 : u32 #[overflow = checked]; - v879 = arith.constant 4 : u32; - v471 = arith.mod v469, v879 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - v473 = hir.load v472 : i32; - v474 = hir.bitcast v437 : u32; - v878 = arith.constant 4 : u32; - v476 = arith.mod v474, v878 : u32; - hir.assertz v476 #[code = 250]; - v477 = hir.int_to_ptr v474 : ptr; - hir.store v477, v473; - v478 = arith.mul v454, v440 : i32 #[overflow = wrapping]; - scf.yield v478; + 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; }; - v479 = arith.constant 8 : i32; - v877 = arith.constant 4 : i32; - v873 = cf.select v460, v877, v479 : i32; - scf.yield v873, v872; + v483 = arith.constant 8 : i32; + v881 = arith.constant 4 : i32; + v877 = cf.select v464, v881, v483 : i32; + scf.yield v877, v876; }; - v482 = arith.add v437, v874 : i32 #[overflow = wrapping]; - v484 = hir.bitcast v482 : u32; - v876 = arith.constant 4 : u32; - v486 = arith.mod v484, v876 : u32; - hir.assertz v486 #[code = 250]; - v487 = hir.int_to_ptr v484 : ptr; - hir.store v487, v875; + 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(v488: i32, v489: i32, v490: i32) { - ^block67(v488: i32, v489: i32, v490: i32): - v889 = arith.constant 0 : i32; - v491 = arith.constant 0 : i32; - v492 = arith.eq v490, v491 : i1; - v493 = arith.zext v492 : u32; - v494 = hir.bitcast v493 : i32; - v496 = arith.neq v494, v889 : i1; - scf.if v496{ - ^block69: + 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 { - ^block70: - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v488, v490, v489) + ^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(v497: i32, v498: i32, v499: i32) { - ^block71(v497: i32, v498: i32, v499: i32): - v501 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v502 = hir.bitcast v501 : ptr; - v503 = hir.load v502 : i32; - v504 = arith.constant 16 : i32; - v505 = arith.sub v503, v504 : i32 #[overflow = wrapping]; - v506 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v507 = hir.bitcast v506 : ptr; - hir.store v507, v505; - v500 = arith.constant 0 : i32; - v508 = arith.constant 8 : i32; - v509 = arith.add v505, v508 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc_impl(v509, v498, v499, v500) - v512 = arith.constant 12 : u32; - v511 = hir.bitcast v505 : u32; - v513 = arith.add v511, v512 : u32 #[overflow = checked]; - v514 = arith.constant 4 : u32; - v515 = arith.mod v513, v514 : u32; - hir.assertz v515 #[code = 250]; - v516 = hir.int_to_ptr v513 : ptr; - v517 = hir.load v516 : i32; - v519 = arith.constant 8 : u32; - v518 = hir.bitcast v505 : u32; - v520 = arith.add v518, v519 : u32 #[overflow = checked]; - v894 = arith.constant 4 : u32; - v522 = arith.mod v520, v894 : u32; - hir.assertz v522 #[code = 250]; - v523 = hir.int_to_ptr v520 : ptr; - v524 = hir.load v523 : i32; - v525 = hir.bitcast v497 : u32; - v893 = arith.constant 4 : u32; - v527 = arith.mod v525, v893 : u32; - hir.assertz v527 #[code = 250]; - v528 = hir.int_to_ptr v525 : ptr; - hir.store v528, v524; - v892 = arith.constant 4 : u32; - v529 = hir.bitcast v497 : u32; - v531 = arith.add v529, v892 : u32 #[overflow = checked]; - v891 = arith.constant 4 : u32; - v533 = arith.mod v531, v891 : u32; - hir.assertz v533 #[code = 250]; - v534 = hir.int_to_ptr v531 : ptr; - hir.store v534, v517; - v890 = arith.constant 16 : i32; - v536 = arith.add v505, v890 : i32 #[overflow = wrapping]; - v537 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v538 = hir.bitcast v537 : ptr; - hir.store v538, v536; + 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(v539: i32, v540: i32, v541: i32, v542: i32, v543: i32) { - ^block73(v539: i32, v540: i32, v541: i32, v542: i32, v543: i32): - v546 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v547 = hir.bitcast v546 : ptr; - v548 = hir.load v547 : i32; - v549 = arith.constant 16 : i32; - v550 = arith.sub v548, v549 : i32 #[overflow = wrapping]; - v551 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v552 = hir.bitcast v551 : ptr; - hir.store v552, v550; - v562 = hir.bitcast v540 : u32; - v563 = arith.zext v562 : u64; - v564 = hir.bitcast v563 : i64; - v544 = arith.constant 0 : i32; - v557 = arith.sub v544, v542 : i32 #[overflow = wrapping]; - v554 = arith.constant -1 : i32; - v553 = arith.add v542, v543 : i32 #[overflow = wrapping]; - v555 = arith.add v553, v554 : i32 #[overflow = wrapping]; - v558 = arith.band v555, v557 : i32; - v559 = hir.bitcast v558 : u32; - v560 = arith.zext v559 : u64; - v561 = hir.bitcast v560 : i64; - v565 = arith.mul v561, v564 : i64 #[overflow = wrapping]; - v997 = arith.constant 0 : i32; - v566 = arith.constant 32 : i64; - v568 = hir.cast v566 : u32; - v567 = hir.bitcast v565 : u64; - v569 = arith.shr v567, v568 : u64; - v570 = hir.bitcast v569 : i64; - v571 = arith.trunc v570 : i32; - v573 = arith.neq v571, v997 : i1; - v910, v911, v912, v913, v914, v915 = scf.if v573 : i32, i32, i32, i32, i32, u32 { - ^block145: - v895 = arith.constant 0 : u32; - v902 = ub.poison i32 : i32; - scf.yield v539, v550, v902, v902, v902, v895; + 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 { - ^block78: - v574 = arith.trunc v565 : i32; - v996 = arith.constant 0 : i32; - v575 = arith.constant -2147483648 : i32; - v576 = arith.sub v575, v542 : i32 #[overflow = wrapping]; - v578 = hir.bitcast v576 : u32; - v577 = hir.bitcast v574 : u32; - v579 = arith.lte v577, v578 : i1; - v580 = arith.zext v579 : u32; - v581 = hir.bitcast v580 : i32; - v583 = arith.neq v581, v996 : i1; - v958 = scf.if v583 : i32 { - ^block76: - v995 = arith.constant 0 : i32; - v594 = arith.neq v574, v995 : i1; - v957 = scf.if v594 : i32 { - ^block80: - v994 = arith.constant 0 : i32; - v610 = arith.neq v541, v994 : i1; - v956 = scf.if v610 : i32 { - ^block83: - v592 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc_impl(v550, v542, v574, v592) - v621 = hir.bitcast v550 : u32; - v662 = arith.constant 4 : u32; - v623 = arith.mod v621, v662 : u32; - hir.assertz v623 #[code = 250]; - v624 = hir.int_to_ptr v621 : ptr; - v625 = hir.load v624 : i32; - scf.yield v625; + ^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 { - ^block84: - v611 = arith.constant 8 : i32; - v612 = arith.add v550, v611 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v612, v542, v574) - v596 = arith.constant 8 : u32; - v613 = hir.bitcast v550 : u32; - v615 = arith.add v613, v596 : u32 #[overflow = checked]; - v993 = arith.constant 4 : u32; - v617 = arith.mod v615, v993 : u32; - hir.assertz v617 #[code = 250]; - v618 = hir.int_to_ptr v615 : ptr; - v619 = hir.load v618 : i32; - scf.yield v619; + ^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; }; - v992 = arith.constant 0 : i32; - v628 = arith.neq v956, v992 : i1; - scf.if v628{ - ^block85: + 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; - v645 = hir.bitcast v539 : u32; - v647 = arith.add v645, v991 : u32 #[overflow = checked]; + v635 = hir.bitcast v543 : u32; + v637 = arith.add v635, v991 : u32 #[overflow = checked]; v990 = arith.constant 4 : u32; - v649 = arith.mod v647, v990 : u32; - hir.assertz v649 #[code = 250]; - v650 = hir.int_to_ptr v647 : ptr; - hir.store v650, v956; + 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; - v652 = hir.bitcast v539 : u32; - v654 = arith.add v652, v989 : u32 #[overflow = checked]; + v642 = hir.bitcast v543 : u32; + v644 = arith.add v642, v989 : u32 #[overflow = checked]; v988 = arith.constant 4 : u32; - v656 = arith.mod v654, v988 : u32; - hir.assertz v656 #[code = 250]; - v657 = hir.int_to_ptr v654 : ptr; - hir.store v657, v540; - scf.yield ; - } else { - ^block86: - v987 = arith.constant 8 : u32; - v631 = hir.bitcast v539 : u32; - v633 = arith.add v631, v987 : u32 #[overflow = checked]; - v986 = arith.constant 4 : u32; - v635 = arith.mod v633, v986 : u32; - hir.assertz v635 #[code = 250]; - v636 = hir.int_to_ptr v633 : ptr; - hir.store v636, v574; - v985 = arith.constant 4 : u32; - v638 = hir.bitcast v539 : u32; - v640 = arith.add v638, v985 : u32 #[overflow = checked]; - v984 = arith.constant 4 : u32; - v642 = arith.mod v640, v984 : u32; - hir.assertz v642 #[code = 250]; - v643 = hir.int_to_ptr v640 : ptr; - hir.store v643, v542; + v646 = arith.mod v644, v988 : u32; + hir.assertz v646 #[code = 250]; + v647 = hir.int_to_ptr v644 : ptr; + hir.store v647, v546; scf.yield ; }; - v982 = arith.constant 1 : i32; - v983 = arith.constant 0 : i32; - v955 = cf.select v628, v983, v982 : i32; - scf.yield v955; + v986 = arith.constant 1 : i32; + v987 = arith.constant 0 : i32; + v959 = cf.select v632, v987, v986 : i32; + scf.yield v959; } else { - ^block81: - v981 = arith.constant 8 : u32; - v595 = hir.bitcast v539 : u32; - v597 = arith.add v595, v981 : u32 #[overflow = checked]; - v980 = arith.constant 4 : u32; - v599 = arith.mod v597, v980 : u32; - hir.assertz v599 #[code = 250]; - v600 = hir.int_to_ptr v597 : ptr; - hir.store v600, v542; - v979 = arith.constant 4 : u32; - v603 = hir.bitcast v539 : u32; - v605 = arith.add v603, v979 : u32 #[overflow = checked]; - v978 = arith.constant 4 : u32; - v607 = arith.mod v605, v978 : u32; - hir.assertz v607 #[code = 250]; - v977 = arith.constant 0 : i32; - v608 = hir.int_to_ptr v605 : ptr; - hir.store v608, v977; - v976 = arith.constant 0 : i32; - scf.yield v976; + ^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 v957; + scf.yield v961; } else { - ^block79: - v975 = ub.poison i32 : i32; - scf.yield v975; + ^block83: + v979 = ub.poison i32 : i32; + scf.yield v979; }; - v970 = arith.constant 0 : u32; - v903 = arith.constant 1 : u32; - v963 = cf.select v583, v903, v970 : u32; - v971 = ub.poison i32 : i32; - v962 = cf.select v583, v550, v971 : i32; - v972 = ub.poison i32 : i32; - v961 = cf.select v583, v539, v972 : i32; - v973 = ub.poison i32 : i32; - v960 = cf.select v583, v973, v550 : i32; - v974 = ub.poison i32 : i32; - v959 = cf.select v583, v974, v539 : i32; - scf.yield v959, v960, v961, v958, v962, v963; + 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; }; - v916, v917, v918 = scf.index_switch v915 : i32, i32, i32 + v920, v921, v922 = scf.index_switch v919 : i32, i32, i32 case 0 { - ^block77: - v969 = arith.constant 4 : u32; - v586 = hir.bitcast v910 : u32; - v588 = arith.add v586, v969 : u32 #[overflow = checked]; - v968 = arith.constant 4 : u32; - v590 = arith.mod v588, v968 : u32; - hir.assertz v590 #[code = 250]; - v967 = arith.constant 0 : i32; - v591 = hir.int_to_ptr v588 : ptr; - hir.store v591, v967; - v966 = arith.constant 1 : i32; - scf.yield v910, v966, v911; + ^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 { - ^block149: - scf.yield v912, v913, v914; + ^block153: + scf.yield v916, v917, v918; }; - v661 = hir.bitcast v916 : u32; - v965 = arith.constant 4 : u32; - v663 = arith.mod v661, v965 : u32; - hir.assertz v663 #[code = 250]; - v664 = hir.int_to_ptr v661 : ptr; - hir.store v664, v917; - v964 = arith.constant 16 : i32; - v669 = arith.add v918, v964 : i32 #[overflow = wrapping]; - v670 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v671 = hir.bitcast v670 : ptr; - hir.store v671, v669; + 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(v672: i32, v673: i32) { - ^block87(v672: i32, v673: i32): + private builtin.function @alloc::raw_vec::handle_error(v676: i32, v677: i32) { + ^block91(v676: i32, v677: i32): ub.unreachable ; }; - private builtin.function @::max(v674: i32, v675: i32) -> i32 { - ^block89(v674: i32, v675: i32): - v682 = arith.constant 0 : i32; - v678 = hir.bitcast v675 : u32; - v677 = hir.bitcast v674 : u32; - v679 = arith.gt v677, v678 : i1; - v680 = arith.zext v679 : u32; - v681 = hir.bitcast v680 : i32; - v683 = arith.neq v681, v682 : i1; - v684 = cf.select v683, v674, v675 : i32; - builtin.ret v684; + 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(v685: i32) -> i32 { - ^block91(v685: i32): - v686, v687 = hir.exec @miden/active_note/get_inputs(v685) : i32, i32 - builtin.ret v686; + 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(v689: i32, v690: i32, v691: i32, v692: i32) -> i32 { - ^block95(v689: i32, v690: i32, v691: i32, v692: i32): - v694 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/cabi_realloc_wit_bindgen_0_46_0(v689, v690, v691, v692) : i32 - builtin.ret v694; + 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(v695: i32, v696: i32) -> i32 { - ^block97(v695: i32, v696: i32): + 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() - v698 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v696, v695) : i32 - builtin.ret v698; + 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(v699: i32, v700: i32, v701: i32, v702: i32) -> i32 { - ^block99(v699: i32, v700: i32, v701: i32, v702: i32): - v704 = arith.constant 0 : i32; - v705 = arith.neq v700, v704 : i1; - v1008, v1009, v1010 = scf.if v705 : i32, i32, u32 { - ^block103: - v713 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_realloc(v699, v700, v701, v702) : i32 - v999 = arith.constant 0 : u32; - v1003 = ub.poison i32 : i32; - scf.yield v713, v1003, v999; + 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 { - ^block104: - v1038 = arith.constant 0 : i32; - v1039 = arith.constant 0 : i32; - v707 = arith.eq v702, v1039 : i1; - v708 = arith.zext v707 : u32; - v709 = hir.bitcast v708 : i32; - v711 = arith.neq v709, v1038 : i1; - v1026 = scf.if v711 : i32 { - ^block152: - v1037 = ub.poison i32 : i32; - scf.yield v1037; + ^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 { - ^block105: - v712 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::alloc(v701, v702) : i32 - scf.yield v712; + ^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; }; - v1035 = arith.constant 0 : u32; - v1004 = arith.constant 1 : u32; - v1028 = cf.select v711, v1004, v1035 : u32; - v1036 = ub.poison i32 : i32; - v1027 = cf.select v711, v701, v1036 : i32; - scf.yield v1026, v1027, v1028; + 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; }; - v1015, v1016 = scf.index_switch v1010 : i32, u32 + v1019, v1020 = scf.index_switch v1014 : i32, u32 case 0 { - ^block102: - v1033 = arith.constant 0 : i32; - v716 = arith.neq v1008, v1033 : i1; - v1030 = arith.constant 1 : u32; - v1031 = arith.constant 0 : u32; - v1025 = cf.select v716, v1031, v1030 : u32; - v1032 = ub.poison i32 : i32; - v1024 = cf.select v716, v1008, v1032 : i32; - scf.yield v1024, v1025; + ^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 { - ^block159: - v1034 = arith.constant 0 : u32; - scf.yield v1009, v1034; + ^block163: + v1038 = arith.constant 0 : u32; + scf.yield v1013, v1038; }; - v1029 = arith.constant 0 : u32; - v1023 = arith.eq v1016, v1029 : i1; - cf.cond_br v1023 ^block154, ^block155; - ^block154: - builtin.ret v1015; - ^block155: + 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(v718: i32, v719: i32, v720: i32, v721: i32) -> i32 { - ^block107(v718: i32, v719: i32, v720: i32, v721: i32): - v723 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/wit_bindgen::rt::cabi_realloc(v718, v719, v720, v721) : i32 - builtin.ret v723; + 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 { 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 index d8cdc4ff4..b0c1ef6a9 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm @@ -461,15 +461,19 @@ pub proc entrypoint( 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.3 + 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::::deallocate + 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 @@ -870,6 +874,20 @@ proc ::with_capacity_in( 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 @@ -1009,6 +1027,13 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop end +@callconv("C") +proc as core::ops::drop::Drop>::drop( + i32 +) + drop +end + @callconv("C") proc >::from( i32 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 index 89860b410..88ad45361 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat @@ -130,9 +130,11 @@ local.get 0 i32.const 4 i32.add + call $ as core::ops::drop::Drop>::drop + local.get 0 i32.const 4 - i32.const 4 - call $::deallocate + i32.add + call $ as core::ops::drop::Drop>::drop local.get 0 i32.const 16 i32.add @@ -261,7 +263,13 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_inputs (;9;) (type 6) (param i32) + (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 @@ -296,17 +304,18 @@ i32.add global.set $__stack_pointer ) - (func $>::from (;10;) (type 7) (param i32) (result f32) + (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 (;11;) (type 8) (param f32 f32) + (func $intrinsics::felt::assert_eq (;13;) (type 8) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;12;) (type 7) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;14;) (type 7) (param i32) (result f32) unreachable ) - (func $::alloc_impl (;13;) (type 9) (param i32 i32 i32 i32) + (func $::alloc_impl (;15;) (type 9) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -333,7 +342,7 @@ local.get 1 i32.store ) - (func $::deallocate (;14;) (type 1) (param i32 i32 i32) + (func $::deallocate (;16;) (type 1) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -365,7 +374,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;15;) (type 9) (param i32 i32 i32 i32) + (func $::current_memory (;17;) (type 9) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -400,7 +409,7 @@ local.get 4 i32.store ) - (func $::deallocate (;16;) (type 1) (param i32 i32 i32) + (func $::deallocate (;18;) (type 1) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -411,7 +420,7 @@ call $__rustc::__rust_dealloc end ) - (func $::allocate (;17;) (type 1) (param i32 i32 i32) + (func $::allocate (;19;) (type 1) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -440,7 +449,7 @@ i32.add global.set $__stack_pointer ) - (func $::try_allocate_in (;18;) (type 10) (param i32 i32 i32 i32 i32) + (func $::try_allocate_in (;20;) (type 10) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -551,10 +560,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;19;) (type 11) (param i32 i32) + (func $alloc::raw_vec::handle_error (;21;) (type 11) (param i32 i32) unreachable ) - (func $::max (;20;) (type 0) (param i32 i32) (result i32) + (func $::max (;22;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -562,23 +571,23 @@ i32.gt_u select ) - (func $miden::active_note::get_inputs (;21;) (type 12) (param i32) (result i32) + (func $miden::active_note::get_inputs (;23;) (type 12) (param i32) (result i32) unreachable ) - (func $cabi_realloc (;22;) (type 2) (param i32 i32 i32 i32) (result i32) + (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 (;23;) (type 0) (param i32 i32) (result i32) + (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 (;24;) (type 2) (param i32 i32 i32 i32) (result i32) + (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 @@ -606,7 +615,7 @@ end local.get 2 ) - (func $cabi_realloc_wit_bindgen_0_46_0 (;25;) (type 2) (param i32 i32 i32 i32) (result i32) + (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 diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index 44c4b194f..79297f75a 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -35,33 +35,33 @@ builtin.component miden:base/transaction-script@1.0.0 { 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 - v925 = arith.constant 0 : 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, v925 : i1; + v31 = arith.neq v29, v929 : i1; scf.if v31{ ^block16: scf.yield ; } else { ^block17: - v923 = arith.constant 0 : i32; - v924 = arith.constant 0 : i32; - v33 = arith.eq v17, v924 : i1; + 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, v923 : i1; + v37 = arith.neq v35, v927 : i1; scf.if v37{ - ^block124: + ^block128: scf.yield ; } else { ^block18: - v917 = arith.constant 0 : u8; + 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, v917; + hir.mem_set v42, v40, v921; scf.yield ; }; scf.yield ; @@ -94,20 +94,20 @@ builtin.component miden:base/transaction-script@1.0.0 { scf.yield ; } else { ^block25: - v929 = arith.constant 0 : i32; + 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, v929 : i1; + v60 = arith.neq v58, v933 : i1; scf.if v60{ ^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; - v928 = arith.constant 1048600 : i32; - v75 = arith.add v73, v928 : i32 #[overflow = wrapping]; + 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) scf.yield ; } else { @@ -115,8 +115,8 @@ builtin.component miden:base/transaction-script@1.0.0 { 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; - v927 = arith.constant 1048600 : i32; - v65 = arith.add v63, v927 : i32 #[overflow = wrapping]; + 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) scf.yield ; }; @@ -144,29 +144,29 @@ builtin.component miden:base/transaction-script@1.0.0 { v94 = arith.neq v92, v80 : i1; cf.cond_br v94 ^block29, ^block30; ^block29: - v936 = arith.constant 4 : u32; + v940 = arith.constant 4 : u32; v96 = hir.bitcast v76 : u32; - v98 = arith.add v96, v936 : u32 #[overflow = checked]; - v935 = arith.constant 4 : u32; - v100 = arith.mod v98, v935 : 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; - v934 = arith.constant 4 : u32; + v938 = arith.constant 4 : u32; v102 = hir.bitcast v77 : u32; - v104 = arith.add v102, v934 : u32 #[overflow = checked]; - v933 = arith.constant 4 : u32; - v106 = arith.mod v104, v933 : 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; - v932 = arith.constant 4 : u32; - v115 = arith.mod v113, v932 : u32; + v936 = arith.constant 4 : u32; + v115 = arith.mod v113, v936 : u32; hir.assertz v115 #[code = 250]; - v930 = arith.constant 2 : u32; - v111 = arith.shl v78, v930 : i32; + 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; @@ -203,14 +203,14 @@ builtin.component miden:base/transaction-script@1.0.0 { 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 - v938 = arith.constant 2 : u32; + v942 = arith.constant 2 : u32; v149 = arith.trunc v148 : i32; - v152 = arith.shl v149, v938 : i32; + v152 = arith.shl v149, v942 : i32; v154 = arith.constant 4 : i32; - v1014 = arith.constant 0 : 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, v1014, v154, v154) + 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]; @@ -222,312 +222,314 @@ builtin.component miden:base/transaction-script@1.0.0 { v164 = arith.constant 64 : u32; v163 = hir.bitcast v129 : u32; v165 = arith.add v163, v164 : u32 #[overflow = checked]; - v1013 = arith.constant 4 : u32; - v167 = arith.mod v165, v1013 : u32; + 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; - v1012 = arith.constant 0 : 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, v1012 : i1; - v943 = scf.if v175 : u32 { + v175 = arith.neq v173, v1016 : i1; + v947 = scf.if v175 : u32 { ^block34: v387 = arith.constant 72 : u32; v386 = hir.bitcast v129 : u32; v388 = arith.add v386, v387 : u32 #[overflow = checked]; - v1011 = arith.constant 4 : u32; - v390 = arith.mod v388, v1011 : u32; + 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) - v939 = arith.constant 0 : u32; - scf.yield v939; + v943 = arith.constant 0 : u32; + scf.yield v943; } else { ^block35: - v1010 = arith.constant 72 : u32; + v1014 = arith.constant 72 : u32; v176 = hir.bitcast v129 : u32; - v178 = arith.add v176, v1010 : u32 #[overflow = checked]; - v1009 = arith.constant 4 : u32; - v180 = arith.mod v178, v1009 : 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; - v1008 = arith.constant 2 : u32; + v1012 = arith.constant 2 : u32; v184 = hir.bitcast v182 : u32; - v186 = arith.shr v184, v1008 : 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]; - v1007 = arith.constant 4 : u32; - v193 = arith.mod v191, v1007 : u32; + 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]; - v1006 = arith.constant 4 : u32; - v199 = arith.mod v197, v1006 : u32; + 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]; - v1005 = arith.constant 4 : u32; - v205 = arith.mod v203, v1005 : u32; + 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; - v1003 = arith.constant 0 : i32; - v1004 = arith.constant 0 : i32; - v208 = arith.eq v152, v1004 : i1; + 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, v1003 : i1; - v945 = scf.if v212 : u32 { - ^block133: - v1002 = arith.constant 0 : u32; - scf.yield v1002; + v212 = arith.neq v210, v1007 : i1; + v949 = scf.if v212 : u32 { + ^block137: + v1006 = arith.constant 0 : u32; + scf.yield v1006; } else { ^block36: v214 = arith.constant 12 : u32; v213 = hir.bitcast v182 : u32; v215 = arith.add v213, v214 : u32 #[overflow = checked]; - v1001 = arith.constant 4 : u32; - v217 = arith.mod v215, v1001 : u32; + 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]; - v1000 = arith.constant 4 : u32; - v224 = arith.mod v222, v1000 : u32; + 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; - v999 = arith.constant 4 : u32; + v1003 = arith.constant 4 : u32; v227 = hir.bitcast v182 : u32; - v229 = arith.add v227, v999 : u32 #[overflow = checked]; - v998 = arith.constant 4 : u32; - v231 = arith.mod v229, v998 : 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; - v997 = arith.constant 4 : u32; - v236 = arith.mod v234, v997 : 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; - v995 = arith.constant 8 : i32; - v996 = arith.constant 4 : i32; + 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, v996, v995) - v994 = arith.constant 12 : u32; + 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, v994 : u32 #[overflow = checked]; - v993 = arith.constant 4 : u32; - v249 = arith.mod v247, v993 : 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; - v991 = arith.constant 0 : i32; - v992 = arith.constant 4 : i32; - v253 = arith.neq v251, v992 : i1; + 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, v991 : i1; - v947 = scf.if v257 : u32 { - ^block132: - v990 = arith.constant 0 : u32; - scf.yield v990; + v257 = arith.neq v255, v995 : i1; + v951 = scf.if v257 : u32 { + ^block136: + v994 = arith.constant 0 : u32; + scf.yield v994; } else { ^block37: - v989 = arith.constant 8 : u32; + v993 = arith.constant 8 : u32; v262 = hir.bitcast v129 : u32; - v264 = arith.add v262, v989 : u32 #[overflow = checked]; - v988 = arith.constant 4 : u32; - v266 = arith.mod v264, v988 : 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; - v987 = arith.constant 8 : i32; - v270 = arith.add v268, v987 : i32 #[overflow = wrapping]; + v991 = arith.constant 8 : i32; + v270 = arith.add v268, v991 : i32 #[overflow = wrapping]; v271 = hir.bitcast v270 : u32; - v986 = arith.constant 4 : u32; - v273 = arith.mod v271, v986 : 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; - v985 = arith.constant 8 : i32; + v989 = arith.constant 8 : i32; v258 = arith.constant 32 : i32; v259 = arith.add v129, v258 : i32 #[overflow = wrapping]; - v261 = arith.add v259, v985 : i32 #[overflow = wrapping]; + v261 = arith.add v259, v989 : i32 #[overflow = wrapping]; v276 = hir.bitcast v261 : u32; - v984 = arith.constant 8 : u32; - v278 = arith.mod v276, v984 : 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; - v983 = arith.constant 4 : u32; - v282 = arith.mod v280, v983 : 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]; - v982 = arith.constant 8 : u32; - v289 = arith.mod v287, v982 : u32; + 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; - v980 = arith.constant 32 : i32; - v294 = arith.add v129, v980 : i32 #[overflow = wrapping]; - v981 = arith.constant 64 : i32; - v292 = arith.add v129, v981 : i32 #[overflow = wrapping]; + 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) - v979 = arith.constant 64 : i32; - v296 = arith.add v129, v979 : i32 #[overflow = wrapping]; + 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; - v977 = arith.constant 8 : i32; - v978 = arith.constant 20 : i32; - v299 = arith.add v129, v978 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v129, v299, v977, v301) - v976 = arith.constant 4 : u32; + 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, v976 : u32 #[overflow = checked]; - v975 = arith.constant 4 : u32; - v306 = arith.mod v304, v975 : 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; - v973 = arith.constant 0 : i32; - v974 = arith.constant 4 : i32; - v310 = arith.neq v308, v974 : i1; + 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, v973 : i1; + v314 = arith.neq v312, v977 : i1; scf.if v314{ - ^block131: + ^block135: scf.yield ; } else { ^block38: v319 = hir.bitcast v129 : u32; - v972 = arith.constant 4 : u32; - v321 = arith.mod v319, v972 : 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; - v971 = arith.constant 8 : i32; - v325 = arith.add v323, v971 : i32 #[overflow = wrapping]; + v975 = arith.constant 8 : i32; + v325 = arith.add v323, v975 : i32 #[overflow = wrapping]; v326 = hir.bitcast v325 : u32; - v970 = arith.constant 4 : u32; - v328 = arith.mod v326, v970 : 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; - v969 = arith.constant 8 : i32; + v973 = arith.constant 8 : i32; v315 = arith.constant 48 : i32; v316 = arith.add v129, v315 : i32 #[overflow = wrapping]; - v318 = arith.add v316, v969 : i32 #[overflow = wrapping]; + v318 = arith.add v316, v973 : i32 #[overflow = wrapping]; v331 = hir.bitcast v318 : u32; - v968 = arith.constant 8 : u32; - v333 = arith.mod v331, v968 : 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; - v967 = arith.constant 4 : u32; - v337 = arith.mod v335, v967 : 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]; - v966 = arith.constant 8 : u32; - v344 = arith.mod v342, v966 : u32; + 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; - v964 = arith.constant 48 : i32; - v349 = arith.add v129, v964 : i32 #[overflow = wrapping]; - v965 = arith.constant 64 : i32; - v347 = arith.add v129, v965 : i32 #[overflow = wrapping]; + 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) - v963 = arith.constant 64 : u32; + v967 = arith.constant 64 : u32; v350 = hir.bitcast v129 : u32; - v352 = arith.add v350, v963 : u32 #[overflow = checked]; - v962 = arith.constant 4 : u32; - v354 = arith.mod v352, v962 : 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; - v961 = arith.constant 68 : u32; + v965 = arith.constant 68 : u32; v357 = hir.bitcast v129 : u32; - v359 = arith.add v357, v961 : u32 #[overflow = checked]; - v960 = arith.constant 4 : u32; - v361 = arith.mod v359, v960 : 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; - v959 = arith.constant 72 : u32; + v963 = arith.constant 72 : u32; v364 = hir.bitcast v129 : u32; - v366 = arith.add v364, v959 : u32 #[overflow = checked]; - v958 = arith.constant 4 : u32; - v368 = arith.mod v366, v958 : 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]; - v957 = arith.constant 4 : u32; - v375 = arith.mod v373, v957 : u32; + 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) - v955 = arith.constant 4 : i32; - v956 = arith.constant 20 : i32; - v379 = arith.add v129, v956 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v379, v955, v955) - v954 = arith.constant 80 : i32; - v383 = arith.add v129, v954 : i32 #[overflow = wrapping]; + 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; scf.yield ; }; - v941 = arith.constant 1 : u32; - v953 = arith.constant 0 : u32; - v951 = cf.select v314, v953, v941 : u32; - scf.yield v951; + v945 = arith.constant 1 : u32; + v957 = arith.constant 0 : u32; + v955 = cf.select v314, v957, v945 : u32; + scf.yield v955; }; - scf.yield v947; + scf.yield v951; }; - scf.yield v945; + scf.yield v949; }; - v952 = arith.constant 0 : u32; - v950 = arith.eq v943, v952 : i1; - cf.cond_br v950 ^block33, ^block135; + v956 = arith.constant 0 : u32; + v954 = arith.eq v947, v956 : i1; + cf.cond_br v954 ^block33, ^block139; ^block33: ub.unreachable ; - ^block135: + ^block139: builtin.ret ; }; @@ -559,12 +561,12 @@ builtin.component miden:base/transaction-script@1.0.0 { v407 = hir.bitcast v406 : ptr; v408 = hir.load v407 : i32; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__wasm_call_ctors() - v1016 = arith.constant 1 : u8; - v1018 = arith.constant 1048620 : i32; - v410 = arith.add v408, v1018 : i32 #[overflow = wrapping]; + 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, v1016; + hir.store v415, v1020; scf.yield ; }; builtin.ret ; @@ -574,27 +576,27 @@ builtin.component miden:base/transaction-script@1.0.0 { ^block45(v416: i32, v417: i32, v418: i32): v421 = arith.constant 16 : i32; v420 = arith.constant 0 : i32; - v1020 = arith.constant 16 : u32; + v1024 = arith.constant 16 : u32; v423 = hir.bitcast v417 : u32; - v425 = arith.gt v423, v1020 : i1; + 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; - v1060 = arith.constant 0 : 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, v1060 : i1; - v1029, v1030 = scf.if v435 : i32, u32 { - ^block143: - v1021 = arith.constant 0 : u32; - v1025 = ub.poison i32 : i32; - scf.yield v1025, v1021; + 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; } else { ^block48: v437 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::max(v417, v430) : i32 - v1059 = arith.constant 0 : i32; + v1063 = arith.constant 0 : i32; v436 = arith.constant -2147483648 : i32; v438 = arith.sub v436, v437 : i32 #[overflow = wrapping]; v440 = hir.bitcast v438 : u32; @@ -602,18 +604,18 @@ builtin.component miden:base/transaction-script@1.0.0 { v441 = arith.gt v439, v440 : i1; v442 = arith.zext v441 : u32; v443 = hir.bitcast v442 : i32; - v445 = arith.neq v443, v1059 : i1; - v1044 = scf.if v445 : i32 { - ^block142: - v1058 = ub.poison i32 : i32; - scf.yield v1058; + v445 = arith.neq v443, v1063 : i1; + v1048 = scf.if v445 : i32 { + ^block146: + v1062 = ub.poison i32 : i32; + scf.yield v1062; } else { ^block49: - v1056 = arith.constant 0 : i32; - v451 = arith.sub v1056, v437 : i32 #[overflow = wrapping]; - v1057 = arith.constant -1 : i32; + 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, v1057 : 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; @@ -621,51 +623,51 @@ builtin.component miden:base/transaction-script@1.0.0 { hir.assertz v455 #[code = 250]; v456 = hir.int_to_ptr v453 : ptr; v457 = hir.load v456 : i32; - v1055 = arith.constant 0 : i32; - v459 = arith.neq v457, v1055 : i1; + v1059 = arith.constant 0 : i32; + v459 = arith.neq v457, v1059 : i1; scf.if v459{ - ^block141: + ^block145: 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; - v1054 = arith.constant 4 : u32; - v469 = arith.mod v467, v1054 : u32; + v1058 = arith.constant 4 : u32; + v469 = arith.mod v467, v1058 : u32; hir.assertz v469 #[code = 250]; - v1053 = arith.constant 16 : u32; + v1057 = arith.constant 16 : u32; v462 = hir.bitcast v461 : i32; - v465 = arith.shl v462, v1053 : 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; scf.yield ; }; v473 = hir.bitcast v416 : u32; - v1052 = arith.constant 4 : u32; - v475 = arith.mod v473, v1052 : 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; - v1050 = arith.constant 0 : i32; - v1051 = arith.constant -1 : i32; - v479 = arith.bxor v477, v1051 : 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, v1050 : i1; - v1043 = scf.if v486 : i32 { + v486 = arith.neq v484, v1054 : i1; + v1047 = scf.if v486 : i32 { ^block52: - v1049 = arith.constant 0 : i32; - scf.yield v1049; + v1053 = arith.constant 0 : i32; + scf.yield v1053; } else { ^block53: v488 = hir.bitcast v416 : u32; - v1048 = arith.constant 4 : u32; - v490 = arith.mod v488, v1048 : 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; @@ -673,20 +675,20 @@ builtin.component miden:base/transaction-script@1.0.0 { v493 = arith.add v477, v437 : i32 #[overflow = wrapping]; scf.yield v493; }; - scf.yield v1043; + scf.yield v1047; }; - v1026 = arith.constant 1 : u32; - v1047 = arith.constant 0 : u32; - v1045 = cf.select v445, v1047, v1026 : u32; - scf.yield v1044, v1045; + v1030 = arith.constant 1 : u32; + v1051 = arith.constant 0 : u32; + v1049 = cf.select v445, v1051, v1030 : u32; + scf.yield v1048, v1049; }; - v1046 = arith.constant 0 : u32; - v1042 = arith.eq v1030, v1046 : i1; - cf.cond_br v1042 ^block47, ^block145(v1029); + v1050 = arith.constant 0 : u32; + v1046 = arith.eq v1034, v1050 : i1; + cf.cond_br v1046 ^block47, ^block149(v1033); ^block47: ub.unreachable ; - ^block145(v1022: i32): - builtin.ret v1022; + ^block149(v1026: i32): + builtin.ret v1026; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -695,586 +697,598 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret v496; }; - private builtin.function @miden_base_sys::bindings::output_note::create(v498: felt, v499: felt, v500: felt, v501: felt, v502: i32) -> felt { - ^block58(v498: felt, v499: felt, v500: felt, v501: felt, v502: i32): - v505 = arith.constant 12 : u32; - v504 = hir.bitcast v502 : u32; - v506 = arith.add v504, v505 : u32 #[overflow = checked]; - v507 = arith.constant 4 : u32; - v508 = arith.mod v506, v507 : u32; - hir.assertz v508 #[code = 250]; - v509 = hir.int_to_ptr v506 : ptr; - v510 = hir.load v509 : felt; - v512 = arith.constant 8 : u32; - v511 = hir.bitcast v502 : u32; - v513 = arith.add v511, v512 : u32 #[overflow = checked]; - v1064 = arith.constant 4 : u32; - v515 = arith.mod v513, v1064 : u32; - hir.assertz v515 #[code = 250]; - v516 = hir.int_to_ptr v513 : ptr; - v517 = hir.load v516 : felt; - v1063 = arith.constant 4 : u32; - v518 = hir.bitcast v502 : u32; - v520 = arith.add v518, v1063 : u32 #[overflow = checked]; - v1062 = arith.constant 4 : u32; - v522 = arith.mod v520, v1062 : u32; - hir.assertz v522 #[code = 250]; - v523 = hir.int_to_ptr v520 : ptr; - v524 = hir.load v523 : felt; - v525 = hir.bitcast v502 : u32; - v1061 = arith.constant 4 : u32; - v527 = arith.mod v525, v1061 : u32; - hir.assertz v527 #[code = 250]; - v528 = hir.int_to_ptr v525 : ptr; - v529 = hir.load v528 : felt; - v530 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::output_note::create(v498, v499, v500, v501, v510, v517, v524, v529) : felt - builtin.ret v530; + 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) + builtin.ret ; }; - private builtin.function @>::from(v531: i32, v532: i32) { - ^block60(v531: i32, v532: i32): - v534 = arith.constant 8 : u32; - v533 = hir.bitcast v532 : u32; - v535 = arith.add v533, v534 : u32 #[overflow = checked]; - v536 = arith.constant 4 : u32; - v537 = arith.mod v535, v536 : u32; - hir.assertz v537 #[code = 250]; - v538 = hir.int_to_ptr v535 : ptr; - v539 = hir.load v538 : i64; - v1068 = arith.constant 8 : u32; - v540 = hir.bitcast v531 : u32; - v542 = arith.add v540, v1068 : u32 #[overflow = checked]; - v1067 = arith.constant 8 : u32; - v544 = arith.mod v542, v1067 : u32; - hir.assertz v544 #[code = 250]; - v545 = hir.int_to_ptr v542 : ptr; - hir.store v545, v539; - v546 = hir.bitcast v532 : u32; + 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; - v548 = arith.mod v546, v1066 : u32; - hir.assertz v548 #[code = 250]; - v549 = hir.int_to_ptr v546 : ptr; - v550 = hir.load v549 : i64; - v551 = hir.bitcast v531 : u32; - v1065 = arith.constant 8 : u32; - v553 = arith.mod v551, v1065 : u32; - hir.assertz v553 #[code = 250]; - v554 = hir.int_to_ptr v551 : ptr; - hir.store v554, v550; + 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 @>::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; builtin.ret ; }; - private builtin.function @intrinsics::advice::adv_push_mapvaln(v555: felt, v556: felt, v557: felt, v558: felt) -> felt { - ^block62(v555: felt, v556: felt, v557: felt, v558: felt): - v559 = hir.exec @intrinsics/advice/adv_push_mapvaln(v555, v556, v557, v558) : felt - builtin.ret v559; + private builtin.function @ as core::ops::drop::Drop>::drop(v558: i32) { + ^block64(v558: 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(v561: felt) -> i64 { - ^block65(v561: felt): - v562 = hir.cast v561 : i64; - builtin.ret v562; + 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(v564: felt, v565: felt) { - ^block67(v564: felt, v565: felt): - hir.assert_eq v564, v565; + 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::felt::from_u32(v566: i32) -> felt { - ^block69(v566: i32): - v567 = hir.bitcast v566 : felt; - builtin.ret v567; + private builtin.function @intrinsics::felt::from_u32(v570: i32) -> felt { + ^block73(v570: i32): + v571 = hir.bitcast v570 : felt; + builtin.ret v571; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v569: i64) -> felt { - ^block71(v569: i64): - v570 = hir.cast v569 : felt; - builtin.ret v570; + 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(v572: felt, v573: i32, v574: felt, v575: felt, v576: felt, v577: felt) -> i32 { - ^block73(v572: felt, v573: i32, v574: felt, v575: felt, v576: felt, v577: felt): - v578 = hir.exec @std/mem/pipe_preimage_to_memory(v572, v573, v574, v575, v576, v577) : i32 - builtin.ret v578; + 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(v580: i32, v581: i32, v582: i32, v583: i32) { - ^block77(v580: i32, v581: i32, v582: i32, v583: i32): - v1084 = arith.constant 0 : i32; - v584 = arith.constant 0 : i32; - v585 = arith.eq v582, v584 : i1; - v586 = arith.zext v585 : u32; - v587 = hir.bitcast v586 : i32; - v589 = arith.neq v587, v1084 : i1; - v1080 = scf.if v589 : i32 { - ^block149: - scf.yield v581; + 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; } else { - ^block80: + ^block84: hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1083 = arith.constant 0 : i32; - v591 = arith.neq v583, v1083 : i1; - v1079 = scf.if v591 : i32 { - ^block81: - v593 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v582, v581) : i32 - scf.yield v593; + 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; } else { - ^block82: - v592 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v582, v581) : i32 - scf.yield v592; + ^block86: + v596 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v586, v585) : i32 + scf.yield v596; }; - scf.yield v1079; + scf.yield v1083; }; - v597 = arith.constant 4 : u32; - v596 = hir.bitcast v580 : u32; - v598 = arith.add v596, v597 : u32 #[overflow = checked]; - v1082 = arith.constant 4 : u32; - v600 = arith.mod v598, v1082 : u32; - hir.assertz v600 #[code = 250]; - v601 = hir.int_to_ptr v598 : ptr; - hir.store v601, v582; - v603 = hir.bitcast v580 : u32; - v1081 = arith.constant 4 : u32; - v605 = arith.mod v603, v1081 : u32; - hir.assertz v605 #[code = 250]; - v606 = hir.int_to_ptr v603 : ptr; - hir.store v606, v1080; + 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; builtin.ret ; }; - private builtin.function @::deallocate(v607: i32, v608: i32, v609: i32) { - ^block83(v607: i32, v608: i32, v609: i32): - v611 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v612 = hir.bitcast v611 : ptr; - v613 = hir.load v612 : i32; - v614 = arith.constant 16 : i32; - v615 = arith.sub v613, v614 : i32 #[overflow = wrapping]; - v616 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v617 = hir.bitcast v616 : ptr; - hir.store v617, v615; - v618 = arith.constant 4 : i32; - v619 = arith.add v615, v618 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::current_memory(v619, v607, v608, v609) - v621 = arith.constant 8 : u32; - v620 = hir.bitcast v615 : u32; - v622 = arith.add v620, v621 : u32 #[overflow = checked]; - v623 = arith.constant 4 : u32; - v624 = arith.mod v622, v623 : u32; - hir.assertz v624 #[code = 250]; - v625 = hir.int_to_ptr v622 : ptr; - v626 = hir.load v625 : i32; - v1091 = arith.constant 0 : i32; - v610 = arith.constant 0 : i32; - v628 = arith.eq v626, v610 : i1; - v629 = arith.zext v628 : u32; - v630 = hir.bitcast v629 : i32; - v632 = arith.neq v630, v1091 : i1; - scf.if v632{ - ^block152: + 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: scf.yield ; } else { - ^block86: - v1090 = arith.constant 4 : u32; - v633 = hir.bitcast v615 : u32; - v635 = arith.add v633, v1090 : u32 #[overflow = checked]; - v1089 = arith.constant 4 : u32; - v637 = arith.mod v635, v1089 : u32; - hir.assertz v637 #[code = 250]; - v638 = hir.int_to_ptr v635 : ptr; - v639 = hir.load v638 : i32; - v641 = arith.constant 12 : u32; - v640 = hir.bitcast v615 : u32; - v642 = arith.add v640, v641 : u32 #[overflow = checked]; - v1088 = arith.constant 4 : u32; - v644 = arith.mod v642, v1088 : u32; - hir.assertz v644 #[code = 250]; - v645 = hir.int_to_ptr v642 : ptr; - v646 = hir.load v645 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v639, v626, v646) + ^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) scf.yield ; }; - v1087 = arith.constant 16 : i32; - v649 = arith.add v615, v1087 : i32 #[overflow = wrapping]; - v650 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v651 = hir.bitcast v650 : ptr; - hir.store v651, v649; + 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; builtin.ret ; }; - private builtin.function @::current_memory(v652: i32, v653: i32, v654: i32, v655: i32) { - ^block87(v652: i32, v653: i32, v654: i32, v655: i32): - v1117 = arith.constant 0 : i32; - v656 = arith.constant 0 : i32; - v660 = arith.eq v655, v656 : i1; - v661 = arith.zext v660 : u32; - v662 = hir.bitcast v661 : i32; - v664 = arith.neq v662, v1117 : i1; - v1104, v1105 = scf.if v664 : i32, i32 { - ^block155: - v1116 = arith.constant 0 : i32; - v658 = arith.constant 4 : i32; - scf.yield v658, v1116; + 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; } else { - ^block90: - v665 = hir.bitcast v653 : u32; - v700 = arith.constant 4 : u32; - v667 = arith.mod v665, v700 : u32; - hir.assertz v667 #[code = 250]; - v668 = hir.int_to_ptr v665 : ptr; - v669 = hir.load v668 : i32; - v1114 = arith.constant 0 : i32; - v1115 = arith.constant 0 : i32; - v671 = arith.eq v669, v1115 : i1; - v672 = arith.zext v671 : u32; - v673 = hir.bitcast v672 : i32; - v675 = arith.neq v673, v1114 : i1; - v1102 = scf.if v675 : i32 { - ^block154: - v1113 = arith.constant 0 : i32; - scf.yield v1113; + ^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; } else { - ^block91: + ^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; - v676 = hir.bitcast v652 : u32; - v678 = arith.add v676, v1112 : u32 #[overflow = checked]; - v1111 = arith.constant 4 : u32; - v680 = arith.mod v678, v1111 : u32; - hir.assertz v680 #[code = 250]; - v681 = hir.int_to_ptr v678 : ptr; - hir.store v681, v654; - v1110 = arith.constant 4 : u32; - v682 = hir.bitcast v653 : u32; - v684 = arith.add v682, v1110 : u32 #[overflow = checked]; - v1109 = arith.constant 4 : u32; - v686 = arith.mod v684, v1109 : u32; - hir.assertz v686 #[code = 250]; - v687 = hir.int_to_ptr v684 : ptr; - v688 = hir.load v687 : i32; - v689 = hir.bitcast v652 : u32; - v1108 = arith.constant 4 : u32; - v691 = arith.mod v689, v1108 : u32; - hir.assertz v691 #[code = 250]; - v692 = hir.int_to_ptr v689 : ptr; - hir.store v692, v688; - v693 = arith.mul v669, v655 : i32 #[overflow = wrapping]; - scf.yield v693; + 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; }; - v694 = arith.constant 8 : i32; - v1107 = arith.constant 4 : i32; - v1103 = cf.select v675, v1107, v694 : i32; - scf.yield v1103, v1102; + v698 = arith.constant 8 : i32; + v1111 = arith.constant 4 : i32; + v1107 = cf.select v679, v1111, v698 : i32; + scf.yield v1107, v1106; }; - v697 = arith.add v652, v1104 : i32 #[overflow = wrapping]; - v699 = hir.bitcast v697 : u32; - v1106 = arith.constant 4 : u32; - v701 = arith.mod v699, v1106 : u32; - hir.assertz v701 #[code = 250]; - v702 = hir.int_to_ptr v699 : ptr; - hir.store v702, v1105; + 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; builtin.ret ; }; - private builtin.function @::deallocate(v703: i32, v704: i32, v705: i32) { - ^block92(v703: i32, v704: i32, v705: i32): - v1119 = arith.constant 0 : i32; - v706 = arith.constant 0 : i32; - v707 = arith.eq v705, v706 : i1; - v708 = arith.zext v707 : u32; - v709 = hir.bitcast v708 : i32; - v711 = arith.neq v709, v1119 : i1; - scf.if v711{ - ^block94: + 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: scf.yield ; } else { - ^block95: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v703, v705, v704) + ^block99: + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v707, v709, v708) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v712: i32, v713: i32, v714: i32) { - ^block96(v712: i32, v713: i32, v714: i32): - v716 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v717 = hir.bitcast v716 : ptr; - v718 = hir.load v717 : i32; - v719 = arith.constant 16 : i32; - v720 = arith.sub v718, v719 : i32 #[overflow = wrapping]; - v721 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v722 = hir.bitcast v721 : ptr; - hir.store v722, v720; - v715 = arith.constant 0 : i32; - v723 = arith.constant 8 : i32; - v724 = arith.add v720, v723 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v724, v713, v714, v715) - v727 = arith.constant 12 : u32; - v726 = hir.bitcast v720 : u32; - v728 = arith.add v726, v727 : u32 #[overflow = checked]; - v729 = arith.constant 4 : u32; - v730 = arith.mod v728, v729 : u32; - hir.assertz v730 #[code = 250]; - v731 = hir.int_to_ptr v728 : ptr; - v732 = hir.load v731 : i32; - v734 = arith.constant 8 : u32; - v733 = hir.bitcast v720 : u32; - v735 = arith.add v733, v734 : u32 #[overflow = checked]; - v1124 = arith.constant 4 : u32; - v737 = arith.mod v735, v1124 : u32; - hir.assertz v737 #[code = 250]; - v738 = hir.int_to_ptr v735 : ptr; - v739 = hir.load v738 : i32; - v740 = hir.bitcast v712 : u32; - v1123 = arith.constant 4 : u32; - v742 = arith.mod v740, v1123 : u32; - hir.assertz v742 #[code = 250]; - v743 = hir.int_to_ptr v740 : ptr; - hir.store v743, v739; - v1122 = arith.constant 4 : u32; - v744 = hir.bitcast v712 : u32; - v746 = arith.add v744, v1122 : u32 #[overflow = checked]; - v1121 = arith.constant 4 : u32; - v748 = arith.mod v746, v1121 : u32; - hir.assertz v748 #[code = 250]; - v749 = hir.int_to_ptr v746 : ptr; - hir.store v749, v732; - v1120 = arith.constant 16 : i32; - v751 = arith.add v720, v1120 : i32 #[overflow = wrapping]; - v752 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v753 = hir.bitcast v752 : ptr; - hir.store v753, v751; + 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; builtin.ret ; }; - private builtin.function @::try_allocate_in(v754: i32, v755: i32, v756: i32, v757: i32, v758: i32) { - ^block98(v754: i32, v755: i32, v756: i32, v757: i32, v758: i32): - v761 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v762 = hir.bitcast v761 : ptr; - v763 = hir.load v762 : i32; - v764 = arith.constant 16 : i32; - v765 = arith.sub v763, v764 : i32 #[overflow = wrapping]; - v766 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v767 = hir.bitcast v766 : ptr; - hir.store v767, v765; - v777 = hir.bitcast v755 : u32; - v778 = arith.zext v777 : u64; - v779 = hir.bitcast v778 : i64; - v759 = arith.constant 0 : i32; - v772 = arith.sub v759, v757 : i32 #[overflow = wrapping]; - v769 = arith.constant -1 : i32; - v768 = arith.add v757, v758 : i32 #[overflow = wrapping]; - v770 = arith.add v768, v769 : i32 #[overflow = wrapping]; - v773 = arith.band v770, v772 : i32; - v774 = hir.bitcast v773 : u32; - v775 = arith.zext v774 : u64; - v776 = hir.bitcast v775 : i64; - v780 = arith.mul v776, v779 : i64 #[overflow = wrapping]; - v1227 = arith.constant 0 : i32; - v781 = arith.constant 32 : i64; - v783 = hir.cast v781 : u32; - v782 = hir.bitcast v780 : u64; - v784 = arith.shr v782, v783 : u64; - v785 = hir.bitcast v784 : i64; - v786 = arith.trunc v785 : i32; - v788 = arith.neq v786, v1227 : i1; - v1140, v1141, v1142, v1143, v1144, v1145 = scf.if v788 : i32, i32, i32, i32, i32, u32 { - ^block159: - v1125 = arith.constant 0 : u32; - v1132 = ub.poison i32 : i32; - scf.yield v754, v765, v1132, v1132, v1132, v1125; + 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; } else { - ^block103: - v789 = arith.trunc v780 : i32; - v1226 = arith.constant 0 : i32; - v790 = arith.constant -2147483648 : i32; - v791 = arith.sub v790, v757 : i32 #[overflow = wrapping]; - v793 = hir.bitcast v791 : u32; - v792 = hir.bitcast v789 : u32; - v794 = arith.lte v792, v793 : i1; - v795 = arith.zext v794 : u32; - v796 = hir.bitcast v795 : i32; - v798 = arith.neq v796, v1226 : i1; - v1188 = scf.if v798 : i32 { - ^block101: - v1225 = arith.constant 0 : i32; - v809 = arith.neq v789, v1225 : i1; - v1187 = scf.if v809 : i32 { - ^block105: - v1224 = arith.constant 0 : i32; - v825 = arith.neq v756, v1224 : i1; - v1186 = scf.if v825 : i32 { - ^block108: - v807 = arith.constant 1 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v765, v757, v789, v807) - v836 = hir.bitcast v765 : u32; - v877 = arith.constant 4 : u32; - v838 = arith.mod v836, v877 : u32; - hir.assertz v838 #[code = 250]; - v839 = hir.int_to_ptr v836 : ptr; - v840 = hir.load v839 : i32; - scf.yield v840; + ^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; } else { - ^block109: - v826 = arith.constant 8 : i32; - v827 = arith.add v765, v826 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v827, v757, v789) - v811 = arith.constant 8 : u32; - v828 = hir.bitcast v765 : u32; - v830 = arith.add v828, v811 : u32 #[overflow = checked]; - v1223 = arith.constant 4 : u32; - v832 = arith.mod v830, v1223 : u32; - hir.assertz v832 #[code = 250]; - v833 = hir.int_to_ptr v830 : ptr; - v834 = hir.load v833 : i32; - scf.yield v834; + ^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; }; - v1222 = arith.constant 0 : i32; - v843 = arith.neq v1186, v1222 : i1; - scf.if v843{ - ^block110: + 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; + scf.yield ; + } else { + ^block115: v1221 = arith.constant 8 : u32; - v860 = hir.bitcast v754 : u32; - v862 = arith.add v860, v1221 : u32 #[overflow = checked]; + v850 = hir.bitcast v758 : u32; + v852 = arith.add v850, v1221 : u32 #[overflow = checked]; v1220 = arith.constant 4 : u32; - v864 = arith.mod v862, v1220 : u32; - hir.assertz v864 #[code = 250]; - v865 = hir.int_to_ptr v862 : ptr; - hir.store v865, v1186; + 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; - v867 = hir.bitcast v754 : u32; - v869 = arith.add v867, v1219 : u32 #[overflow = checked]; + v857 = hir.bitcast v758 : u32; + v859 = arith.add v857, v1219 : u32 #[overflow = checked]; v1218 = arith.constant 4 : u32; - v871 = arith.mod v869, v1218 : u32; - hir.assertz v871 #[code = 250]; - v872 = hir.int_to_ptr v869 : ptr; - hir.store v872, v755; - scf.yield ; - } else { - ^block111: - v1217 = arith.constant 8 : u32; - v846 = hir.bitcast v754 : u32; - v848 = arith.add v846, v1217 : u32 #[overflow = checked]; - v1216 = arith.constant 4 : u32; - v850 = arith.mod v848, v1216 : u32; - hir.assertz v850 #[code = 250]; - v851 = hir.int_to_ptr v848 : ptr; - hir.store v851, v789; - v1215 = arith.constant 4 : u32; - v853 = hir.bitcast v754 : u32; - v855 = arith.add v853, v1215 : u32 #[overflow = checked]; - v1214 = arith.constant 4 : u32; - v857 = arith.mod v855, v1214 : u32; - hir.assertz v857 #[code = 250]; - v858 = hir.int_to_ptr v855 : ptr; - hir.store v858, v757; + v861 = arith.mod v859, v1218 : u32; + hir.assertz v861 #[code = 250]; + v862 = hir.int_to_ptr v859 : ptr; + hir.store v862, v761; scf.yield ; }; - v1212 = arith.constant 1 : i32; - v1213 = arith.constant 0 : i32; - v1185 = cf.select v843, v1213, v1212 : i32; - scf.yield v1185; + v1216 = arith.constant 1 : i32; + v1217 = arith.constant 0 : i32; + v1189 = cf.select v847, v1217, v1216 : i32; + scf.yield v1189; } else { - ^block106: - v1211 = arith.constant 8 : u32; - v810 = hir.bitcast v754 : u32; - v812 = arith.add v810, v1211 : u32 #[overflow = checked]; - v1210 = arith.constant 4 : u32; - v814 = arith.mod v812, v1210 : u32; - hir.assertz v814 #[code = 250]; - v815 = hir.int_to_ptr v812 : ptr; - hir.store v815, v757; - v1209 = arith.constant 4 : u32; - v818 = hir.bitcast v754 : u32; - v820 = arith.add v818, v1209 : u32 #[overflow = checked]; - v1208 = arith.constant 4 : u32; - v822 = arith.mod v820, v1208 : u32; - hir.assertz v822 #[code = 250]; - v1207 = arith.constant 0 : i32; - v823 = hir.int_to_ptr v820 : ptr; - hir.store v823, v1207; - v1206 = arith.constant 0 : i32; - scf.yield v1206; + ^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; }; - scf.yield v1187; + scf.yield v1191; } else { - ^block104: - v1205 = ub.poison i32 : i32; - scf.yield v1205; + ^block108: + v1209 = ub.poison i32 : i32; + scf.yield v1209; }; - v1200 = arith.constant 0 : u32; - v1133 = arith.constant 1 : u32; - v1193 = cf.select v798, v1133, v1200 : u32; - v1201 = ub.poison i32 : i32; - v1192 = cf.select v798, v765, v1201 : i32; - v1202 = ub.poison i32 : i32; - v1191 = cf.select v798, v754, v1202 : i32; - v1203 = ub.poison i32 : i32; - v1190 = cf.select v798, v1203, v765 : i32; - v1204 = ub.poison i32 : i32; - v1189 = cf.select v798, v1204, v754 : i32; - scf.yield v1189, v1190, v1191, v1188, v1192, v1193; + 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; }; - v1146, v1147, v1148 = scf.index_switch v1145 : i32, i32, i32 + v1150, v1151, v1152 = scf.index_switch v1149 : i32, i32, i32 case 0 { - ^block102: - v1199 = arith.constant 4 : u32; - v801 = hir.bitcast v1140 : u32; - v803 = arith.add v801, v1199 : u32 #[overflow = checked]; - v1198 = arith.constant 4 : u32; - v805 = arith.mod v803, v1198 : u32; - hir.assertz v805 #[code = 250]; - v1197 = arith.constant 0 : i32; - v806 = hir.int_to_ptr v803 : ptr; - hir.store v806, v1197; - v1196 = arith.constant 1 : i32; - scf.yield v1140, v1196, v1141; + ^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; } default { - ^block163: - scf.yield v1142, v1143, v1144; + ^block167: + scf.yield v1146, v1147, v1148; }; - v876 = hir.bitcast v1146 : u32; - v1195 = arith.constant 4 : u32; - v878 = arith.mod v876, v1195 : u32; - hir.assertz v878 #[code = 250]; - v879 = hir.int_to_ptr v876 : ptr; - hir.store v879, v1147; - v1194 = arith.constant 16 : i32; - v884 = arith.add v1148, v1194 : i32 #[overflow = wrapping]; - v885 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v886 = hir.bitcast v885 : ptr; - hir.store v886, v884; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v887: i32, v888: i32) { - ^block112(v887: i32, v888: i32): + private builtin.function @alloc::raw_vec::handle_error(v891: i32, v892: i32) { + ^block116(v891: i32, v892: i32): ub.unreachable ; }; - private builtin.function @core::slice::index::slice_index_fail::do_panic::runtime(v889: i32, v890: i32, v891: i32) { - ^block114(v889: i32, v890: i32, v891: i32): + 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): ub.unreachable ; }; - private builtin.function @::max(v892: i32, v893: i32) -> i32 { - ^block116(v892: i32, v893: i32): - v900 = arith.constant 0 : i32; - v896 = hir.bitcast v893 : u32; - v895 = hir.bitcast v892 : u32; - v897 = arith.gt v895, v896 : i1; - v898 = arith.zext v897 : u32; - v899 = hir.bitcast v898 : i32; - v901 = arith.neq v899, v900 : i1; - v902 = cf.select v901, v892, v893 : i32; - builtin.ret v902; + 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 @miden::output_note::create(v903: felt, v904: felt, v905: felt, v906: felt, v907: felt, v908: felt, v909: felt, v910: felt) -> felt { - ^block118(v903: felt, v904: felt, v905: felt, v906: felt, v907: felt, v908: felt, v909: felt, v910: felt): - v911 = hir.exec @miden/output_note/create(v903, v904, v905, v906, v907, v908, v909, v910) : felt - builtin.ret v911; + 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; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1290,9 +1304,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v913: felt, v914: felt, v915: felt, v916: felt) { - ^block122(v913: felt, v914: felt, v915: felt, v916: felt): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v913, v914, v915, v916) + 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) 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 2c405257d..865986108 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -1078,16 +1078,20 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) 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 - push.4 push.20 - dup.3 + 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 + trace.252 + nop + push.20 + dup.2 u32wrapping_add - dup.1 - swap.2 - swap.1 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:: as core::ops::drop::Drop>::drop trace.252 nop push.80 @@ -1391,6 +1395,20 @@ proc intrinsics::mem::heap_base( nop end +@callconv("C") +proc as core::ops::drop::Drop>::drop( + i32 +) + push.4 + dup.0 + swap.2 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::deallocate + trace.252 + nop +end + @callconv("C") proc miden_base_sys::bindings::output_note::create( felt, @@ -1554,6 +1572,13 @@ proc as core::ops::drop::Drop>::drop( + i32 +) + drop +end + @callconv("C") proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt trace.240 diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index 731dfffb5..109a772e3 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -35,16 +35,17 @@ (type (;5;) (func (param f32 f32 f32 f32))) (type (;6;) (func (param i32 i32 i32) (result i32))) (type (;7;) (func (result i32))) - (type (;8;) (func (param f32 f32 f32 f32 i32) (result f32))) - (type (;9;) (func (param i32 i32))) - (type (;10;) (func (param f32 f32 f32 f32) (result f32))) - (type (;11;) (func (param f32) (result i64))) - (type (;12;) (func (param f32 f32))) - (type (;13;) (func (param i32) (result f32))) - (type (;14;) (func (param i64) (result f32))) - (type (;15;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) - (type (;16;) (func (param i32 i32 i32 i32 i32))) - (type (;17;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) + (type (;8;) (func (param i32))) + (type (;9;) (func (param f32 f32 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))) + (type (;13;) (func (param f32 f32))) + (type (;14;) (func (param i32) (result f32))) + (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))) (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) @@ -328,9 +329,11 @@ local.get 4 i32.const 20 i32.add - i32.const 4 - i32.const 4 - call $::deallocate + call $ as core::ops::drop::Drop>::drop + local.get 4 + i32.const 20 + i32.add + call $ as core::ops::drop::Drop>::drop local.get 4 i32.const 80 i32.add @@ -440,7 +443,13 @@ (func $intrinsics::mem::heap_base (;12;) (type 7) (result i32) unreachable ) - (func $miden_base_sys::bindings::output_note::create (;13;) (type 8) (param f32 f32 f32 f32 i32) (result f32) + (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) local.get 0 local.get 1 local.get 2 @@ -455,7 +464,7 @@ f32.load call $miden::output_note::create ) - (func $>::from (;14;) (type 9) (param i32 i32) + (func $>::from (;15;) (type 10) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -465,25 +474,26 @@ i64.load align=4 i64.store ) - (func $intrinsics::advice::adv_push_mapvaln (;15;) (type 10) (param f32 f32 f32 f32) (result f32) + (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 ) - (func $intrinsics::felt::as_u64 (;16;) (type 11) (param f32) (result i64) + (func $intrinsics::felt::as_u64 (;18;) (type 12) (param f32) (result i64) unreachable ) - (func $intrinsics::felt::assert_eq (;17;) (type 12) (param f32 f32) + (func $intrinsics::felt::assert_eq (;19;) (type 13) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;18;) (type 13) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;20;) (type 14) (param i32) (result f32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;19;) (type 14) (param i64) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;21;) (type 15) (param i64) (result f32) unreachable ) - (func $std::mem::pipe_preimage_to_memory (;20;) (type 15) (param f32 i32 f32 f32 f32 f32) (result i32) + (func $std::mem::pipe_preimage_to_memory (;22;) (type 16) (param f32 i32 f32 f32 f32 f32) (result i32) unreachable ) - (func $::alloc_impl (;21;) (type 4) (param i32 i32 i32 i32) + (func $::alloc_impl (;23;) (type 4) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -510,7 +520,7 @@ local.get 1 i32.store ) - (func $::deallocate (;22;) (type 3) (param i32 i32 i32) + (func $::deallocate (;24;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -542,7 +552,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;23;) (type 4) (param i32 i32 i32 i32) + (func $::current_memory (;25;) (type 4) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -577,7 +587,7 @@ local.get 4 i32.store ) - (func $::deallocate (;24;) (type 3) (param i32 i32 i32) + (func $::deallocate (;26;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -588,7 +598,7 @@ call $__rustc::__rust_dealloc end ) - (func $::allocate (;25;) (type 3) (param i32 i32 i32) + (func $::allocate (;27;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -617,7 +627,7 @@ i32.add global.set $__stack_pointer ) - (func $::try_allocate_in (;26;) (type 16) (param i32 i32 i32 i32 i32) + (func $::try_allocate_in (;28;) (type 17) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -728,13 +738,13 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;27;) (type 9) (param i32 i32) + (func $alloc::raw_vec::handle_error (;29;) (type 10) (param i32 i32) unreachable ) - (func $core::slice::index::slice_index_fail::do_panic::runtime (;28;) (type 3) (param i32 i32 i32) + (func $core::slice::index::slice_index_fail::do_panic::runtime (;30;) (type 3) (param i32 i32 i32) unreachable ) - (func $::max (;29;) (type 2) (param i32 i32) (result i32) + (func $::max (;31;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -742,7 +752,7 @@ i32.gt_u select ) - (func $miden::output_note::create (;30;) (type 17) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + (func $miden::output_note::create (;32;) (type 18) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "\00") diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index d3e535085..a9d798e6b 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -35,33 +35,33 @@ builtin.component miden:base/note-script@1.0.0 { 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 - v888 = arith.constant 0 : 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, v888 : i1; + v30 = arith.neq v28, v892 : i1; scf.if v30{ ^block16: scf.yield ; } else { ^block17: - v886 = arith.constant 0 : i32; - v887 = arith.constant 0 : i32; - v32 = arith.eq v16, v887 : i1; + 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, v886 : i1; + v36 = arith.neq v34, v890 : i1; scf.if v36{ - ^block114: + ^block118: scf.yield ; } else { ^block18: - v880 = arith.constant 0 : u8; + 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, v880; + hir.mem_set v41, v39, v884; scf.yield ; }; scf.yield ; @@ -97,38 +97,38 @@ builtin.component miden:base/note-script@1.0.0 { v64 = hir.int_to_ptr v61 : ptr; v65 = hir.load v64 : i32; v66 = hir.cast v65 : u32; - v946 = scf.index_switch v66 : u32 + v950 = scf.index_switch v66 : u32 case 0 { - ^block119: - v990 = arith.constant 1 : u32; - scf.yield v990; + ^block123: + v994 = arith.constant 1 : u32; + scf.yield v994; } case 1 { - ^block120: - v989 = arith.constant 1 : u32; - scf.yield v989; + ^block124: + v993 = arith.constant 1 : u32; + scf.yield v993; } default { ^block24: v68 = arith.constant 20 : u32; v67 = hir.bitcast v54 : u32; v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v1023 = arith.constant 4 : u32; - v71 = arith.mod v69, v1023 : u32; + 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; - v1022 = arith.constant 4 : u32; + v1027 = arith.constant 4 : u32; v74 = hir.bitcast v73 : u32; - v76 = arith.add v74, v1022 : u32 #[overflow = checked]; - v1021 = arith.constant 4 : u32; - v78 = arith.mod v76, v1021 : u32; + v76 = arith.add v74, v1027 : u32 #[overflow = checked]; + v1026 = arith.constant 4 : u32; + v78 = arith.mod v76, v1026 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; v80 = hir.load v79 : felt; v81 = hir.bitcast v73 : u32; - v1020 = arith.constant 4 : u32; - v83 = arith.mod v81, v1020 : 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; @@ -138,16 +138,16 @@ builtin.component miden:base/note-script@1.0.0 { v89 = arith.constant 12 : u32; v88 = hir.bitcast v54 : u32; v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v1019 = arith.constant 4 : u32; - v92 = arith.mod v90, v1019 : u32; + 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]; - v1018 = arith.constant 4 : u32; - v99 = arith.mod v97, v1018 : u32; + 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; @@ -158,21 +158,21 @@ builtin.component miden:base/note-script@1.0.0 { v105 = arith.zext v104 : u32; v106 = hir.bitcast v105 : i32; v108 = arith.neq v106, v47 : i1; - v948 = scf.if v108 : u32 { - ^block118: - v898 = arith.constant 1 : u32; - scf.yield v898; + v952 = scf.if v108 : u32 { + ^block122: + v902 = arith.constant 1 : u32; + scf.yield v902; } else { ^block25: v109 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v94, v80) : i32 - v1016 = arith.constant 0 : i32; - v1017 = arith.constant 1 : i32; - v111 = arith.neq v109, v1017 : i1; + 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, v1016 : i1; + v115 = arith.neq v113, v1021 : i1; scf.if v115{ - ^block117: + ^block121: scf.yield ; } else { ^block26: @@ -182,139 +182,141 @@ builtin.component miden:base/note-script@1.0.0 { v119 = arith.constant 36 : u32; v118 = hir.bitcast v54 : u32; v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v1015 = arith.constant 4 : u32; - v122 = arith.mod v120, v1015 : u32; + 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]; - v1014 = arith.constant 4 : u32; - v132 = arith.mod v130, v1014 : u32; + 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]; - v1013 = arith.constant 4 : u32; - v139 = arith.mod v137, v1013 : u32; + 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; - v1012 = arith.constant 4 : u32; - v127 = arith.shl v124, v1012 : i32; - v966, v967, v968, v969, v970, v971, v972, v973 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block132(v974: i32, v975: i32, v976: i32, v977: i32, v978: i32): - v1010 = arith.constant 0 : i32; - v1011 = arith.constant 0 : i32; - v144 = arith.eq v974, v1011 : i1; + 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, v1010 : i1; - v959, v960 = scf.if v148 : i32, i32 { - ^block131: - v899 = ub.poison i32 : i32; - scf.yield v899, v899; + v148 = arith.neq v146, v1015 : i1; + v963, v964 = scf.if v148 : i32, i32 { + ^block135: + v903 = ub.poison i32 : i32; + scf.yield v903, v903; } else { ^block30: - v150 = hir.bitcast v975 : u32; - v1009 = arith.constant 4 : u32; - v152 = arith.mod v150, v1009 : u32; + 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; - v1008 = arith.constant 4 : u32; - v155 = hir.bitcast v975 : u32; - v157 = arith.add v155, v1008 : u32 #[overflow = checked]; - v1007 = arith.constant 4 : u32; - v159 = arith.mod v157, v1007 : u32; + 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; - v1006 = arith.constant 8 : u32; - v162 = hir.bitcast v975 : u32; - v164 = arith.add v162, v1006 : u32 #[overflow = checked]; - v1005 = arith.constant 4 : u32; - v166 = arith.mod v164, v1005 : u32; + 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; - v1004 = arith.constant 12 : u32; - v169 = hir.bitcast v975 : u32; - v171 = arith.add v169, v1004 : u32 #[overflow = checked]; - v1003 = arith.constant 4 : u32; - v173 = arith.mod v171, v1003 : u32; + 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) - v1002 = arith.constant 16 : i32; - v179 = arith.add v975, v1002 : i32 #[overflow = wrapping]; + v1007 = arith.constant 16 : i32; + v179 = arith.add v979, v1007 : i32 #[overflow = wrapping]; v176 = arith.constant -16 : i32; - v177 = arith.add v974, v176 : i32 #[overflow = wrapping]; + v177 = arith.add v978, v176 : i32 #[overflow = wrapping]; scf.yield v177, v179; }; - v998 = ub.poison i32 : i32; - v963 = cf.select v148, v998, v978 : i32; - v999 = ub.poison i32 : i32; - v962 = cf.select v148, v999, v977 : i32; - v1000 = ub.poison i32 : i32; - v961 = cf.select v148, v1000, v976 : i32; - v1001 = arith.constant 1 : u32; - v890 = arith.constant 0 : u32; - v965 = cf.select v148, v890, v1001 : u32; - v943 = arith.trunc v965 : i1; - scf.condition v943, v959, v960, v961, v962, v963, v976, v977, v978; + 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; } do { - ^block133(v979: i32, v980: i32, v981: i32, v982: i32, v983: i32, v984: i32, v985: i32, v986: i32): - scf.yield v979, v980, v981, v982, v983; + ^block137(v983: i32, v984: i32, v985: i32, v986: i32, v987: i32, v988: i32, v989: i32, v990: i32): + scf.yield v983, v984, v985, v986, v987; }; v183 = arith.constant 44 : u32; - v182 = hir.bitcast v971 : u32; + v182 = hir.bitcast v975 : u32; v184 = arith.add v182, v183 : u32 #[overflow = checked]; - v997 = arith.constant 4 : u32; - v186 = arith.mod v184, v997 : u32; + 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, v972; + hir.store v187, v976; v190 = arith.constant 40 : u32; - v189 = hir.bitcast v971 : u32; + v189 = hir.bitcast v975 : u32; v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v996 = arith.constant 4 : u32; - v193 = arith.mod v191, v996 : u32; + 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, v973; - v995 = arith.constant 16 : i32; + hir.store v194, v977; + v1000 = arith.constant 16 : i32; v195 = arith.constant 40 : i32; - v196 = arith.add v971, v195 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v196, v995, v995) - v125 = arith.constant 4 : i32; - v994 = arith.constant 16 : i32; - v200 = arith.add v971, v994 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v200, v125, v125) - v993 = arith.constant 48 : i32; - v204 = arith.add v971, v993 : i32 #[overflow = wrapping]; + 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; scf.yield ; }; - v991 = arith.constant 0 : u32; - v992 = arith.constant 1 : u32; - v987 = cf.select v115, v992, v991 : u32; - scf.yield v987; + v995 = arith.constant 0 : u32; + v996 = arith.constant 1 : u32; + v991 = cf.select v115, v996, v995 : u32; + scf.yield v991; }; - scf.yield v948; + scf.yield v952; }; - v988 = arith.constant 0 : u32; - v958 = arith.eq v946, v988 : i1; - cf.cond_br v958 ^block122, ^block23; + v992 = arith.constant 0 : u32; + v962 = arith.eq v950, v992 : i1; + cf.cond_br v962 ^block126, ^block23; ^block23: ub.unreachable ; - ^block122: + ^block126: builtin.ret ; }; @@ -346,12 +348,12 @@ builtin.component miden:base/note-script@1.0.0 { v221 = hir.bitcast v220 : ptr; v222 = hir.load v221 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1025 = arith.constant 1 : u8; - v1027 = arith.constant 1048592 : i32; - v224 = arith.add v222, v1027 : i32 #[overflow = wrapping]; + 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, v1025; + hir.store v229, v1030; scf.yield ; }; builtin.ret ; @@ -361,27 +363,27 @@ builtin.component miden:base/note-script@1.0.0 { ^block37(v230: i32, v231: i32, v232: i32): v235 = arith.constant 16 : i32; v234 = arith.constant 0 : i32; - v1029 = arith.constant 16 : u32; + v1034 = arith.constant 16 : u32; v237 = hir.bitcast v231 : u32; - v239 = arith.gt v237, v1029 : i1; + 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; - v1069 = arith.constant 0 : 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, v1069 : i1; - v1038, v1039 = scf.if v249 : i32, u32 { - ^block137: - v1030 = arith.constant 0 : u32; - v1034 = ub.poison i32 : i32; - scf.yield v1034, v1030; + 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; } else { ^block40: v251 = hir.exec @miden:base/note-script@1.0.0/p2id/::max(v231, v244) : i32 - v1068 = arith.constant 0 : i32; + v1073 = arith.constant 0 : i32; v250 = arith.constant -2147483648 : i32; v252 = arith.sub v250, v251 : i32 #[overflow = wrapping]; v254 = hir.bitcast v252 : u32; @@ -389,18 +391,18 @@ builtin.component miden:base/note-script@1.0.0 { v255 = arith.gt v253, v254 : i1; v256 = arith.zext v255 : u32; v257 = hir.bitcast v256 : i32; - v259 = arith.neq v257, v1068 : i1; - v1053 = scf.if v259 : i32 { - ^block136: - v1067 = ub.poison i32 : i32; - scf.yield v1067; + v259 = arith.neq v257, v1073 : i1; + v1058 = scf.if v259 : i32 { + ^block140: + v1072 = ub.poison i32 : i32; + scf.yield v1072; } else { ^block41: - v1065 = arith.constant 0 : i32; - v265 = arith.sub v1065, v251 : i32 #[overflow = wrapping]; - v1066 = arith.constant -1 : i32; + 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, v1066 : 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; @@ -408,51 +410,51 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v269 #[code = 250]; v270 = hir.int_to_ptr v267 : ptr; v271 = hir.load v270 : i32; - v1064 = arith.constant 0 : i32; - v273 = arith.neq v271, v1064 : i1; + v1069 = arith.constant 0 : i32; + v273 = arith.neq v271, v1069 : i1; scf.if v273{ - ^block135: + ^block139: 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; - v1063 = arith.constant 4 : u32; - v283 = arith.mod v281, v1063 : u32; + v1068 = arith.constant 4 : u32; + v283 = arith.mod v281, v1068 : u32; hir.assertz v283 #[code = 250]; - v1062 = arith.constant 16 : u32; + v1067 = arith.constant 16 : u32; v276 = hir.bitcast v275 : i32; - v279 = arith.shl v276, v1062 : 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; scf.yield ; }; v287 = hir.bitcast v230 : u32; - v1061 = arith.constant 4 : u32; - v289 = arith.mod v287, v1061 : 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; - v1059 = arith.constant 0 : i32; - v1060 = arith.constant -1 : i32; - v293 = arith.bxor v291, v1060 : 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, v1059 : i1; - v1052 = scf.if v300 : i32 { + v300 = arith.neq v298, v1064 : i1; + v1057 = scf.if v300 : i32 { ^block44: - v1058 = arith.constant 0 : i32; - scf.yield v1058; + v1063 = arith.constant 0 : i32; + scf.yield v1063; } else { ^block45: v302 = hir.bitcast v230 : u32; - v1057 = arith.constant 4 : u32; - v304 = arith.mod v302, v1057 : 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; @@ -460,20 +462,20 @@ builtin.component miden:base/note-script@1.0.0 { v307 = arith.add v291, v251 : i32 #[overflow = wrapping]; scf.yield v307; }; - scf.yield v1052; + scf.yield v1057; }; - v1035 = arith.constant 1 : u32; - v1056 = arith.constant 0 : u32; - v1054 = cf.select v259, v1056, v1035 : u32; - scf.yield v1053, v1054; + v1040 = arith.constant 1 : u32; + v1061 = arith.constant 0 : u32; + v1059 = cf.select v259, v1061, v1040 : u32; + scf.yield v1058, v1059; }; - v1055 = arith.constant 0 : u32; - v1051 = arith.eq v1039, v1055 : i1; - cf.cond_br v1051 ^block39, ^block139(v1038); + v1060 = arith.constant 0 : u32; + v1056 = arith.eq v1044, v1060 : i1; + cf.cond_br v1056 ^block39, ^block143(v1043); ^block39: ub.unreachable ; - ^block139(v1031: i32): - builtin.ret v1031; + ^block143(v1036: i32): + builtin.ret v1036; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -492,21 +494,21 @@ builtin.component miden:base/note-script@1.0.0 { v320 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v321 = hir.bitcast v320 : ptr; hir.store v321, v319; - v1074 = arith.constant 16 : i32; + 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, v1074, v1074) + 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]; - v1073 = arith.constant 8 : u32; - v330 = arith.mod v328, v1073 : u32; + 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; - v1072 = arith.constant 8 : u32; + v1077 = arith.constant 8 : u32; v334 = hir.bitcast v312 : u32; - v336 = arith.add v334, v1072 : u32 #[overflow = checked]; + v336 = arith.add v334, v1077 : u32 #[overflow = checked]; v337 = arith.constant 4 : u32; v338 = arith.mod v336, v337 : u32; hir.assertz v338 #[code = 250]; @@ -514,13 +516,13 @@ builtin.component miden:base/note-script@1.0.0 { v339 = hir.int_to_ptr v336 : ptr; hir.store v339, v313; v340 = hir.bitcast v312 : u32; - v1071 = arith.constant 4 : u32; - v342 = arith.mod v340, v1071 : 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; - v1070 = arith.constant 16 : i32; - v345 = arith.add v319, v1070 : i32 #[overflow = wrapping]; + 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; @@ -550,56 +552,56 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v367 #[code = 250]; v368 = hir.int_to_ptr v365 : ptr; v369 = hir.load v368 : i32; - v1085 = arith.constant 4 : u32; + v1090 = arith.constant 4 : u32; v370 = hir.bitcast v356 : u32; - v372 = arith.add v370, v1085 : u32 #[overflow = checked]; - v1084 = arith.constant 4 : u32; - v374 = arith.mod v372, v1084 : 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; - v1083 = arith.constant 0 : 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, v1083 : i1; + v382 = arith.neq v380, v1088 : i1; cf.cond_br v382 ^block54, ^block55; ^block54: v391 = arith.constant 12 : u32; v390 = hir.bitcast v356 : u32; v392 = arith.add v390, v391 : u32 #[overflow = checked]; - v1082 = arith.constant 4 : u32; - v394 = arith.mod v392, v1082 : u32; + 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; - v1081 = arith.constant 4 : u32; + v1086 = arith.constant 4 : u32; v397 = hir.bitcast v348 : u32; - v399 = arith.add v397, v1081 : u32 #[overflow = checked]; - v1080 = arith.constant 4 : u32; - v401 = arith.mod v399, v1080 : 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; - v1079 = arith.constant 4 : u32; - v405 = arith.mod v403, v1079 : 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; - v1078 = arith.constant 16 : i32; - v408 = arith.add v356, v1078 : i32 #[overflow = wrapping]; + 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; builtin.ret ; ^block55: - v1077 = arith.constant 12 : u32; + v1082 = arith.constant 12 : u32; v383 = hir.bitcast v356 : u32; - v385 = arith.add v383, v1077 : u32 #[overflow = checked]; - v1076 = arith.constant 4 : u32; - v387 = arith.mod v385, v1076 : 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; @@ -607,658 +609,670 @@ builtin.component miden:base/note-script@1.0.0 { ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_assets(v411: i32) { + private builtin.function @ as core::ops::drop::Drop>::drop(v411: i32) { ^block56(v411: i32): - v413 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v414 = hir.bitcast v413 : ptr; - v415 = hir.load v414 : i32; - v416 = arith.constant 16 : i32; - v417 = arith.sub v415, v416 : i32 #[overflow = wrapping]; - v418 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v419 = hir.bitcast v418 : ptr; - hir.store v419, v417; - v420 = arith.constant 4 : i32; - v421 = arith.add v417, v420 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/>::with_capacity(v421) - v425 = arith.constant 8 : u32; - v424 = hir.bitcast v417 : u32; - v426 = arith.add v424, v425 : u32 #[overflow = checked]; - v427 = arith.constant 4 : u32; - v428 = arith.mod v426, v427 : u32; - hir.assertz v428 #[code = 250]; - v429 = hir.int_to_ptr v426 : ptr; - v430 = hir.load v429 : i32; - v1086 = arith.constant 2 : u32; - v432 = hir.bitcast v430 : u32; - v434 = arith.shr v432, v1086 : u32; - v435 = hir.bitcast v434 : i32; - v436 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v435) : i32 - v422 = arith.constant 8 : i32; - v423 = arith.add v411, v422 : i32 #[overflow = wrapping]; - v437 = hir.bitcast v423 : u32; - v1091 = arith.constant 4 : u32; - v439 = arith.mod v437, v1091 : u32; - hir.assertz v439 #[code = 250]; - v440 = hir.int_to_ptr v437 : ptr; - hir.store v440, v436; - v1090 = arith.constant 4 : u32; - v441 = hir.bitcast v417 : u32; - v443 = arith.add v441, v1090 : u32 #[overflow = checked]; - v1089 = arith.constant 4 : u32; - v445 = arith.mod v443, v1089 : u32; - hir.assertz v445 #[code = 250]; - v446 = hir.int_to_ptr v443 : ptr; - v447 = hir.load v446 : i64; - v448 = hir.bitcast v411 : u32; - v1088 = arith.constant 4 : u32; - v450 = arith.mod v448, v1088 : u32; - hir.assertz v450 #[code = 250]; - v451 = hir.int_to_ptr v448 : ptr; - hir.store v451, v447; - v1087 = arith.constant 16 : i32; - v453 = arith.add v417, v1087 : i32 #[overflow = wrapping]; - v454 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v455 = hir.bitcast v454 : ptr; - hir.store v455, v453; + v412 = arith.constant 4 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v411, v412, v412) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v456: i32) { - ^block58(v456: i32): - v458 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__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:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v464 = hir.bitcast v463 : ptr; - hir.store v464, v462; - v467 = arith.constant 4 : i32; - v465 = arith.constant 8 : i32; - v466 = arith.add v462, v465 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::with_capacity_in(v466, v467, v467) - v470 = arith.constant 8 : u32; - v469 = hir.bitcast v462 : u32; - v471 = arith.add v469, v470 : u32 #[overflow = checked]; - v472 = arith.constant 4 : u32; - v473 = arith.mod v471, v472 : u32; - hir.assertz v473 #[code = 250]; - v474 = hir.int_to_ptr v471 : ptr; - v475 = hir.load v474 : i32; - v477 = arith.constant 12 : u32; - v476 = hir.bitcast v462 : u32; - v478 = arith.add v476, v477 : u32 #[overflow = checked]; - v1099 = arith.constant 4 : u32; - v480 = arith.mod v478, v1099 : u32; - hir.assertz v480 #[code = 250]; - v481 = hir.int_to_ptr v478 : ptr; - v482 = hir.load v481 : i32; - v1092 = arith.constant 2 : u32; - v484 = hir.bitcast v482 : u32; - v486 = arith.shr v484, v1092 : u32; - v487 = hir.bitcast v486 : i32; - v488 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v487) : i32 - v1098 = arith.constant 8 : u32; - v489 = hir.bitcast v456 : u32; - v491 = arith.add v489, v1098 : u32 #[overflow = checked]; - v1097 = arith.constant 4 : u32; - v493 = arith.mod v491, v1097 : u32; - hir.assertz v493 #[code = 250]; - v494 = hir.int_to_ptr v491 : ptr; - hir.store v494, v488; + 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; - v495 = hir.bitcast v456 : u32; - v497 = arith.add v495, v1096 : u32 #[overflow = checked]; + 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; - v499 = arith.mod v497, v1095 : u32; - hir.assertz v499 #[code = 250]; - v500 = hir.int_to_ptr v497 : ptr; - hir.store v500, v482; - v501 = hir.bitcast v456 : u32; + v444 = hir.bitcast v420 : u32; + v446 = arith.add v444, v1095 : u32 #[overflow = checked]; v1094 = arith.constant 4 : u32; - v503 = arith.mod v501, v1094 : u32; - hir.assertz v503 #[code = 250]; - v504 = hir.int_to_ptr v501 : ptr; - hir.store v504, v475; - v1093 = arith.constant 16 : i32; - v506 = arith.add v462, v1093 : i32 #[overflow = wrapping]; - v507 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v508 = hir.bitcast v507 : ptr; - hir.store v508, v506; + 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; + 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; + 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; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_account::get_id(v509: i32) { - ^block60(v509: i32): - v511 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v512 = hir.bitcast v511 : ptr; - v513 = hir.load v512 : i32; - v514 = arith.constant 16 : i32; - v515 = arith.sub v513, v514 : i32 #[overflow = wrapping]; - v516 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v517 = hir.bitcast v516 : ptr; - hir.store v517, v515; - v518 = arith.constant 8 : i32; - v519 = arith.add v515, v518 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v519) - v521 = arith.constant 8 : u32; - v520 = hir.bitcast v515 : u32; - v522 = arith.add v520, v521 : u32 #[overflow = checked]; - v523 = arith.constant 4 : u32; - v524 = arith.mod v522, v523 : u32; - hir.assertz v524 #[code = 250]; - v525 = hir.int_to_ptr v522 : ptr; - v526 = hir.load v525 : i64; - v527 = hir.bitcast v509 : u32; - v1101 = arith.constant 8 : u32; - v529 = arith.mod v527, v1101 : u32; - hir.assertz v529 #[code = 250]; - v530 = hir.int_to_ptr v527 : ptr; - hir.store v530, v526; - v1100 = arith.constant 16 : i32; - v532 = arith.add v515, v1100 : i32 #[overflow = wrapping]; - v533 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v534 = hir.bitcast v533 : ptr; - hir.store v534, v532; + private builtin.function @ as core::ops::drop::Drop>::drop(v538: i32) { + ^block64(v538: i32): builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v535: felt, v536: felt) -> i32 { - ^block62(v535: felt, v536: felt): - v537 = arith.eq v535, v536 : i1; - v538 = hir.cast v537 : i32; - builtin.ret v538; + 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(v540: i32, v541: i32, v542: i32, v543: i32) { - ^block64(v540: i32, v541: i32, v542: i32, v543: i32): - v1117 = arith.constant 0 : i32; - v544 = arith.constant 0 : i32; - v545 = arith.eq v542, v544 : i1; - v546 = arith.zext v545 : u32; - v547 = hir.bitcast v546 : i32; - v549 = arith.neq v547, v1117 : i1; - v1113 = scf.if v549 : i32 { - ^block145: - scf.yield v541; + 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; } else { - ^block67: + ^block71: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1116 = arith.constant 0 : i32; - v551 = arith.neq v543, v1116 : i1; - v1112 = scf.if v551 : i32 { - ^block68: - v553 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v542, v541) : i32 - scf.yield v553; + 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; } else { - ^block69: - v552 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v542, v541) : i32 - scf.yield v552; + ^block73: + v556 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v546, v545) : i32 + scf.yield v556; }; - scf.yield v1112; + scf.yield v1117; }; - v557 = arith.constant 4 : u32; - v556 = hir.bitcast v540 : u32; - v558 = arith.add v556, v557 : u32 #[overflow = checked]; - v1115 = arith.constant 4 : u32; - v560 = arith.mod v558, v1115 : u32; - hir.assertz v560 #[code = 250]; - v561 = hir.int_to_ptr v558 : ptr; - hir.store v561, v542; - v563 = hir.bitcast v540 : u32; - v1114 = arith.constant 4 : u32; - v565 = arith.mod v563, v1114 : u32; - hir.assertz v565 #[code = 250]; - v566 = hir.int_to_ptr v563 : ptr; - hir.store v566, v1113; + 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; builtin.ret ; }; - private builtin.function @::deallocate(v567: i32, v568: i32, v569: i32) { - ^block70(v567: i32, v568: i32, v569: i32): - v571 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v572 = hir.bitcast v571 : ptr; - v573 = hir.load v572 : i32; - v574 = arith.constant 16 : i32; - v575 = arith.sub v573, v574 : i32 #[overflow = wrapping]; - v576 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v577 = hir.bitcast v576 : ptr; - hir.store v577, v575; - v578 = arith.constant 4 : i32; - v579 = arith.add v575, v578 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::current_memory(v579, v567, v568, v569) - v581 = arith.constant 8 : u32; - v580 = hir.bitcast v575 : u32; - v582 = arith.add v580, v581 : u32 #[overflow = checked]; - v583 = arith.constant 4 : u32; - v584 = arith.mod v582, v583 : u32; - hir.assertz v584 #[code = 250]; - v585 = hir.int_to_ptr v582 : ptr; - v586 = hir.load v585 : i32; - v1124 = arith.constant 0 : i32; - v570 = arith.constant 0 : i32; - v588 = arith.eq v586, v570 : i1; - v589 = arith.zext v588 : u32; - v590 = hir.bitcast v589 : i32; - v592 = arith.neq v590, v1124 : i1; - scf.if v592{ - ^block148: + 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: scf.yield ; } else { - ^block73: - v1123 = arith.constant 4 : u32; - v593 = hir.bitcast v575 : u32; - v595 = arith.add v593, v1123 : u32 #[overflow = checked]; - v1122 = arith.constant 4 : u32; - v597 = arith.mod v595, v1122 : u32; - hir.assertz v597 #[code = 250]; - v598 = hir.int_to_ptr v595 : ptr; - v599 = hir.load v598 : i32; - v601 = arith.constant 12 : u32; - v600 = hir.bitcast v575 : u32; - v602 = arith.add v600, v601 : u32 #[overflow = checked]; - v1121 = arith.constant 4 : u32; - v604 = arith.mod v602, v1121 : u32; - hir.assertz v604 #[code = 250]; - v605 = hir.int_to_ptr v602 : ptr; - v606 = hir.load v605 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v599, v586, v606) + ^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) scf.yield ; }; - v1120 = arith.constant 16 : i32; - v609 = arith.add v575, v1120 : 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; + 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; builtin.ret ; }; - private builtin.function @::current_memory(v612: i32, v613: i32, v614: i32, v615: i32) { - ^block74(v612: i32, v613: i32, v614: i32, v615: i32): - v1150 = arith.constant 0 : i32; - v616 = arith.constant 0 : i32; - v620 = arith.eq v615, v616 : i1; - v621 = arith.zext v620 : u32; - v622 = hir.bitcast v621 : i32; - v624 = arith.neq v622, v1150 : i1; - v1137, v1138 = scf.if v624 : i32, i32 { - ^block151: - v1149 = arith.constant 0 : i32; - v618 = arith.constant 4 : i32; - scf.yield v618, v1149; + 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; } else { - ^block77: - v625 = hir.bitcast v613 : u32; - v660 = arith.constant 4 : u32; - v627 = arith.mod v625, v660 : u32; - hir.assertz v627 #[code = 250]; - v628 = hir.int_to_ptr v625 : ptr; - v629 = hir.load v628 : i32; - v1147 = arith.constant 0 : i32; - v1148 = arith.constant 0 : i32; - v631 = arith.eq v629, v1148 : i1; - v632 = arith.zext v631 : u32; - v633 = hir.bitcast v632 : i32; - v635 = arith.neq v633, v1147 : i1; - v1135 = scf.if v635 : i32 { - ^block150: - v1146 = arith.constant 0 : i32; - scf.yield v1146; + ^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; } else { - ^block78: - v1145 = arith.constant 4 : u32; - v636 = hir.bitcast v612 : u32; - v638 = arith.add v636, v1145 : u32 #[overflow = checked]; - v1144 = arith.constant 4 : u32; - v640 = arith.mod v638, v1144 : u32; - hir.assertz v640 #[code = 250]; - v641 = hir.int_to_ptr v638 : ptr; - hir.store v641, v614; - v1143 = arith.constant 4 : u32; - v642 = hir.bitcast v613 : u32; - v644 = arith.add v642, v1143 : u32 #[overflow = checked]; - v1142 = arith.constant 4 : u32; - v646 = arith.mod v644, v1142 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - v648 = hir.load v647 : i32; - v649 = hir.bitcast v612 : u32; - v1141 = arith.constant 4 : u32; - v651 = arith.mod v649, v1141 : u32; - hir.assertz v651 #[code = 250]; - v652 = hir.int_to_ptr v649 : ptr; - hir.store v652, v648; - v653 = arith.mul v629, v615 : i32 #[overflow = wrapping]; - scf.yield v653; + ^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; }; - v654 = arith.constant 8 : i32; - v1140 = arith.constant 4 : i32; - v1136 = cf.select v635, v1140, v654 : i32; - scf.yield v1136, v1135; + v658 = arith.constant 8 : i32; + v1145 = arith.constant 4 : i32; + v1141 = cf.select v639, v1145, v658 : i32; + scf.yield v1141, v1140; }; - v657 = arith.add v612, v1137 : i32 #[overflow = wrapping]; - v659 = hir.bitcast v657 : u32; - v1139 = arith.constant 4 : u32; - v661 = arith.mod v659, v1139 : u32; - hir.assertz v661 #[code = 250]; - v662 = hir.int_to_ptr v659 : ptr; - hir.store v662, v1138; + 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; builtin.ret ; }; - private builtin.function @::deallocate(v663: i32, v664: i32, v665: i32) { - ^block79(v663: i32, v664: i32, v665: i32): - v1152 = arith.constant 0 : i32; - v666 = arith.constant 0 : i32; - v667 = arith.eq v665, v666 : i1; - v668 = arith.zext v667 : u32; - v669 = hir.bitcast v668 : i32; - v671 = arith.neq v669, v1152 : i1; - scf.if v671{ - ^block81: + 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: scf.yield ; } else { - ^block82: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v663, v665, v664) + ^block86: + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v667, v669, v668) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v672: i32, v673: i32, v674: i32) { - ^block83(v672: i32, v673: i32, v674: i32): - v676 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v677 = hir.bitcast v676 : ptr; - v678 = hir.load v677 : i32; - v679 = arith.constant 16 : i32; - v680 = arith.sub v678, v679 : i32 #[overflow = wrapping]; - v681 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v682 = hir.bitcast v681 : ptr; - hir.store v682, v680; - v675 = arith.constant 0 : i32; - v683 = arith.constant 8 : i32; - v684 = arith.add v680, v683 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v684, v673, v674, v675) - v687 = arith.constant 12 : u32; - v686 = hir.bitcast v680 : u32; - v688 = arith.add v686, v687 : u32 #[overflow = checked]; - v689 = arith.constant 4 : u32; - v690 = arith.mod v688, v689 : u32; - hir.assertz v690 #[code = 250]; - v691 = hir.int_to_ptr v688 : ptr; - v692 = hir.load v691 : i32; - v694 = arith.constant 8 : u32; - v693 = hir.bitcast v680 : u32; - v695 = arith.add v693, v694 : u32 #[overflow = checked]; - v1157 = arith.constant 4 : u32; - v697 = arith.mod v695, v1157 : u32; - hir.assertz v697 #[code = 250]; - v698 = hir.int_to_ptr v695 : ptr; - v699 = hir.load v698 : i32; - v700 = hir.bitcast v672 : u32; - v1156 = arith.constant 4 : u32; - v702 = arith.mod v700, v1156 : u32; - hir.assertz v702 #[code = 250]; - v703 = hir.int_to_ptr v700 : ptr; - hir.store v703, v699; - v1155 = arith.constant 4 : u32; - v704 = hir.bitcast v672 : u32; - v706 = arith.add v704, v1155 : u32 #[overflow = checked]; - v1154 = arith.constant 4 : u32; - v708 = arith.mod v706, v1154 : u32; - hir.assertz v708 #[code = 250]; - v709 = hir.int_to_ptr v706 : ptr; - hir.store v709, v692; - v1153 = arith.constant 16 : i32; - v711 = arith.add v680, v1153 : i32 #[overflow = wrapping]; - v712 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v713 = hir.bitcast v712 : ptr; - hir.store v713, v711; + 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; builtin.ret ; }; - private builtin.function @::try_allocate_in(v714: i32, v715: i32, v716: i32, v717: i32, v718: i32) { - ^block85(v714: i32, v715: i32, v716: i32, v717: i32, v718: i32): - v721 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v722 = hir.bitcast v721 : ptr; - v723 = hir.load v722 : i32; - v724 = arith.constant 16 : i32; - v725 = arith.sub v723, v724 : i32 #[overflow = wrapping]; - v726 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v727 = hir.bitcast v726 : ptr; - hir.store v727, v725; - v737 = hir.bitcast v715 : u32; - v738 = arith.zext v737 : u64; - v739 = hir.bitcast v738 : i64; - v719 = arith.constant 0 : i32; - v732 = arith.sub v719, v717 : i32 #[overflow = wrapping]; - v729 = arith.constant -1 : i32; - v728 = arith.add v717, v718 : i32 #[overflow = wrapping]; - v730 = arith.add v728, v729 : i32 #[overflow = wrapping]; - v733 = arith.band v730, v732 : i32; - v734 = hir.bitcast v733 : u32; - v735 = arith.zext v734 : u64; - v736 = hir.bitcast v735 : i64; - v740 = arith.mul v736, v739 : i64 #[overflow = wrapping]; - v1260 = arith.constant 0 : i32; - v741 = arith.constant 32 : i64; - v743 = hir.cast v741 : u32; - v742 = hir.bitcast v740 : u64; - v744 = arith.shr v742, v743 : u64; - v745 = hir.bitcast v744 : i64; - v746 = arith.trunc v745 : i32; - v748 = arith.neq v746, v1260 : i1; - v1173, v1174, v1175, v1176, v1177, v1178 = scf.if v748 : i32, i32, i32, i32, i32, u32 { - ^block155: - v1158 = arith.constant 0 : u32; - v1165 = ub.poison i32 : i32; - scf.yield v714, v725, v1165, v1165, v1165, v1158; + 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; } else { - ^block90: - v749 = arith.trunc v740 : i32; - v1259 = arith.constant 0 : i32; - v750 = arith.constant -2147483648 : i32; - v751 = arith.sub v750, v717 : i32 #[overflow = wrapping]; - v753 = hir.bitcast v751 : u32; - v752 = hir.bitcast v749 : u32; - v754 = arith.lte v752, v753 : i1; - v755 = arith.zext v754 : u32; - v756 = hir.bitcast v755 : i32; - v758 = arith.neq v756, v1259 : i1; - v1221 = scf.if v758 : i32 { - ^block88: - v1258 = arith.constant 0 : i32; - v769 = arith.neq v749, v1258 : i1; - v1220 = scf.if v769 : i32 { - ^block92: - v1257 = arith.constant 0 : i32; - v785 = arith.neq v716, v1257 : i1; - v1219 = scf.if v785 : i32 { - ^block95: - v767 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v725, v717, v749, v767) - v796 = hir.bitcast v725 : u32; - v837 = arith.constant 4 : u32; - v798 = arith.mod v796, v837 : u32; - hir.assertz v798 #[code = 250]; - v799 = hir.int_to_ptr v796 : ptr; - v800 = hir.load v799 : i32; - scf.yield v800; + ^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; } else { - ^block96: - v786 = arith.constant 8 : i32; - v787 = arith.add v725, v786 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v787, v717, v749) - v771 = arith.constant 8 : u32; - v788 = hir.bitcast v725 : u32; - v790 = arith.add v788, v771 : u32 #[overflow = checked]; - v1256 = arith.constant 4 : u32; - v792 = arith.mod v790, v1256 : u32; - hir.assertz v792 #[code = 250]; - v793 = hir.int_to_ptr v790 : ptr; - v794 = hir.load v793 : i32; - scf.yield v794; + ^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; }; - v1255 = arith.constant 0 : i32; - v803 = arith.neq v1219, v1255 : i1; - scf.if v803{ - ^block97: - v1254 = arith.constant 8 : u32; - v820 = hir.bitcast v714 : u32; - v822 = arith.add v820, v1254 : u32 #[overflow = checked]; - v1253 = arith.constant 4 : u32; - v824 = arith.mod v822, v1253 : u32; - hir.assertz v824 #[code = 250]; - v825 = hir.int_to_ptr v822 : ptr; - hir.store v825, v1219; - v1252 = arith.constant 4 : u32; - v827 = hir.bitcast v714 : u32; - v829 = arith.add v827, v1252 : u32 #[overflow = checked]; - v1251 = arith.constant 4 : u32; - v831 = arith.mod v829, v1251 : u32; - hir.assertz v831 #[code = 250]; - v832 = hir.int_to_ptr v829 : ptr; - hir.store v832, v715; + 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; scf.yield ; } else { - ^block98: - v1250 = arith.constant 8 : u32; - v806 = hir.bitcast v714 : u32; - v808 = arith.add v806, v1250 : u32 #[overflow = checked]; - v1249 = arith.constant 4 : u32; - v810 = arith.mod v808, v1249 : u32; - hir.assertz v810 #[code = 250]; - v811 = hir.int_to_ptr v808 : ptr; - hir.store v811, v749; - v1248 = arith.constant 4 : u32; - v813 = hir.bitcast v714 : u32; - v815 = arith.add v813, v1248 : u32 #[overflow = checked]; - v1247 = arith.constant 4 : u32; - v817 = arith.mod v815, v1247 : u32; - hir.assertz v817 #[code = 250]; - v818 = hir.int_to_ptr v815 : ptr; - hir.store v818, v717; + ^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; scf.yield ; }; - v1245 = arith.constant 1 : i32; - v1246 = arith.constant 0 : i32; - v1218 = cf.select v803, v1246, v1245 : i32; - scf.yield v1218; + v1250 = arith.constant 1 : i32; + v1251 = arith.constant 0 : i32; + v1223 = cf.select v807, v1251, v1250 : i32; + scf.yield v1223; } else { - ^block93: - v1244 = arith.constant 8 : u32; - v770 = hir.bitcast v714 : u32; - v772 = arith.add v770, v1244 : u32 #[overflow = checked]; - v1243 = arith.constant 4 : u32; - v774 = arith.mod v772, v1243 : u32; - hir.assertz v774 #[code = 250]; - v775 = hir.int_to_ptr v772 : ptr; - hir.store v775, v717; - v1242 = arith.constant 4 : u32; - v778 = hir.bitcast v714 : u32; - v780 = arith.add v778, v1242 : u32 #[overflow = checked]; - v1241 = arith.constant 4 : u32; - v782 = arith.mod v780, v1241 : u32; - hir.assertz v782 #[code = 250]; - v1240 = arith.constant 0 : i32; - v783 = hir.int_to_ptr v780 : ptr; - hir.store v783, v1240; - v1239 = arith.constant 0 : i32; - scf.yield v1239; + ^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; }; - scf.yield v1220; + scf.yield v1225; } else { - ^block91: - v1238 = ub.poison i32 : i32; - scf.yield v1238; + ^block95: + v1243 = ub.poison i32 : i32; + scf.yield v1243; }; - v1233 = arith.constant 0 : u32; - v1166 = arith.constant 1 : u32; - v1226 = cf.select v758, v1166, v1233 : u32; - v1234 = ub.poison i32 : i32; - v1225 = cf.select v758, v725, v1234 : i32; - v1235 = ub.poison i32 : i32; - v1224 = cf.select v758, v714, v1235 : i32; - v1236 = ub.poison i32 : i32; - v1223 = cf.select v758, v1236, v725 : i32; - v1237 = ub.poison i32 : i32; - v1222 = cf.select v758, v1237, v714 : i32; - scf.yield v1222, v1223, v1224, v1221, v1225, v1226; + 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; }; - v1179, v1180, v1181 = scf.index_switch v1178 : i32, i32, i32 + v1184, v1185, v1186 = scf.index_switch v1183 : i32, i32, i32 case 0 { - ^block89: - v1232 = arith.constant 4 : u32; - v761 = hir.bitcast v1173 : u32; - v763 = arith.add v761, v1232 : u32 #[overflow = checked]; - v1231 = arith.constant 4 : u32; - v765 = arith.mod v763, v1231 : u32; - hir.assertz v765 #[code = 250]; - v1230 = arith.constant 0 : i32; - v766 = hir.int_to_ptr v763 : ptr; - hir.store v766, v1230; - v1229 = arith.constant 1 : i32; - scf.yield v1173, v1229, v1174; + ^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; } default { - ^block159: - scf.yield v1175, v1176, v1177; + ^block163: + scf.yield v1180, v1181, v1182; }; - v836 = hir.bitcast v1179 : u32; - v1228 = arith.constant 4 : u32; - v838 = arith.mod v836, v1228 : u32; - hir.assertz v838 #[code = 250]; - v839 = hir.int_to_ptr v836 : ptr; - hir.store v839, v1180; - v1227 = arith.constant 16 : i32; - v844 = arith.add v1181, v1227 : i32 #[overflow = wrapping]; - v845 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v846 = hir.bitcast v845 : ptr; - hir.store v846, v844; + 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; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v847: i32, v848: i32) { - ^block99(v847: i32, v848: i32): + private builtin.function @alloc::raw_vec::handle_error(v851: i32, v852: i32) { + ^block103(v851: i32, v852: i32): ub.unreachable ; }; - private builtin.function @::max(v849: i32, v850: i32) -> i32 { - ^block101(v849: i32, v850: i32): - v857 = arith.constant 0 : i32; - v853 = hir.bitcast v850 : u32; - v852 = hir.bitcast v849 : u32; - v854 = arith.gt v852, v853 : i1; - v855 = arith.zext v854 : u32; - v856 = hir.bitcast v855 : i32; - v858 = arith.neq v856, v857 : i1; - v859 = cf.select v858, v849, v850 : i32; - builtin.ret v859; + 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 @miden::active_account::get_id(v860: i32) { - ^block103(v860: i32): - v861, v862 = hir.exec @miden/active_account/get_id() : felt, felt - v863 = hir.bitcast v860 : u32; - v864 = hir.int_to_ptr v863 : ptr; - hir.store v864, v861; - v865 = arith.constant 4 : u32; - v866 = arith.add v863, v865 : u32 #[overflow = checked]; - v867 = hir.int_to_ptr v866 : ptr; - hir.store v867, v862; + 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; builtin.ret ; }; - private builtin.function @miden::active_note::get_assets(v868: i32) -> i32 { - ^block107(v868: i32): - v869, v870 = hir.exec @miden/active_note/get_assets(v868) : i32, i32 - builtin.ret v869; + 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::active_note::get_inputs(v872: i32) -> i32 { - ^block110(v872: i32): - v873, v874 = hir.exec @miden/active_note/get_inputs(v872) : i32, i32 - builtin.ret v873; + 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; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1272,9 +1286,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v876: felt, v877: felt, v878: felt, v879: felt) { - ^block112(v876: felt, v877: felt, v878: felt, v879: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v876, v877, v878, v879) + 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) 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 725ed2437..194dea317 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -632,16 +632,20 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::p2id::::deallocate trace.252 nop - push.4 push.16 - dup.2 + dup.1 u32wrapping_add + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id:: as core::ops::drop::Drop>::drop + trace.252 + nop + push.16 dup.1 - swap.2 - swap.1 + u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::deallocate + exec.::miden:base/note-script@1.0.0::p2id:: as core::ops::drop::Drop>::drop trace.252 nop push.48 @@ -1215,6 +1219,20 @@ proc ::with_capacity_in( end end +@callconv("C") +proc as core::ops::drop::Drop>::drop( + i32 +) + push.4 + dup.0 + swap.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::::deallocate + trace.252 + nop +end + @callconv("C") proc miden_base_sys::bindings::active_note::get_assets( i32 @@ -1550,6 +1568,13 @@ proc miden_base_sys::bindings::active_account::get_id(i32) nop end +@callconv("C") +proc as core::ops::drop::Drop>::drop( + i32 +) + drop +end + @callconv("C") proc intrinsics::felt::eq(felt, felt) -> i32 eq diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 4f5df28e9..8216aa73f 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -176,9 +176,11 @@ local.get 4 i32.const 16 i32.add - i32.const 4 - i32.const 4 - call $::deallocate + 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.add @@ -352,7 +354,13 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_assets (;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 + call $::deallocate + ) + (func $miden_base_sys::bindings::active_note::get_assets (;14;) (type 6) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -381,7 +389,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_inputs (;14;) (type 6) (param i32) + (func $miden_base_sys::bindings::active_note::get_inputs (;15;) (type 6) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -416,7 +424,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_account::get_id (;15;) (type 6) (param i32) + (func $miden_base_sys::bindings::active_account::get_id (;16;) (type 6) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -436,10 +444,11 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::eq (;16;) (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 7) (param f32 f32) (result i32) unreachable ) - (func $::alloc_impl (;17;) (type 8) (param i32 i32 i32 i32) + (func $::alloc_impl (;19;) (type 8) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -466,7 +475,7 @@ local.get 1 i32.store ) - (func $::deallocate (;18;) (type 3) (param i32 i32 i32) + (func $::deallocate (;20;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -498,7 +507,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;19;) (type 8) (param i32 i32 i32 i32) + (func $::current_memory (;21;) (type 8) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -533,7 +542,7 @@ local.get 4 i32.store ) - (func $::deallocate (;20;) (type 3) (param i32 i32 i32) + (func $::deallocate (;22;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -544,7 +553,7 @@ call $__rustc::__rust_dealloc end ) - (func $::allocate (;21;) (type 3) (param i32 i32 i32) + (func $::allocate (;23;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -573,7 +582,7 @@ i32.add global.set $__stack_pointer ) - (func $::try_allocate_in (;22;) (type 9) (param i32 i32 i32 i32 i32) + (func $::try_allocate_in (;24;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -684,10 +693,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;23;) (type 10) (param i32 i32) + (func $alloc::raw_vec::handle_error (;25;) (type 10) (param i32 i32) unreachable ) - (func $::max (;24;) (type 2) (param i32 i32) (result i32) + (func $::max (;26;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -695,13 +704,13 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;25;) (type 6) (param i32) + (func $miden::active_account::get_id (;27;) (type 6) (param i32) unreachable ) - (func $miden::active_note::get_assets (;26;) (type 11) (param i32) (result i32) + (func $miden::active_note::get_assets (;28;) (type 11) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_inputs (;27;) (type 11) (param i32) (result i32) + (func $miden::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") From 7d51997b20bb6178987a1323d5b7d283385348ec Mon Sep 17 00:00:00 2001 From: Gengar Date: Wed, 17 Dec 2025 17:54:29 +0200 Subject: [PATCH 66/70] docs: fix grammatical incossistencies and typos (#824) --- .../src/appendix/calling-conventions.md | 8 +++--- .../appendix/canonabi-adhocabi-mismatch.md | 10 +++---- .../src/appendix/known-limitations.md | 14 +++++----- docs/external/src/guides/debugger.md | 6 ++-- docs/external/src/guides/rust_to_wasm.md | 2 +- docs/external/src/index.md | 4 +-- docs/internal/src/analyses.md | 2 +- docs/internal/src/data_layout.md | 2 +- docs/internal/src/ir.md | 28 +++++++++---------- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/docs/external/src/appendix/calling-conventions.md b/docs/external/src/appendix/calling-conventions.md index bee90c0ef..f9c6a1999 100644 --- a/docs/external/src/appendix/calling-conventions.md +++ b/docs/external/src/appendix/calling-conventions.md @@ -14,7 +14,7 @@ There are four calling conventions represented in the compiler: We specifically use the System V ABI because it is well understood, documented, and straightforward. - `Fast`, this convention allows the compiler to follow either the `C` calling convention, or modify it as it sees fit on a function-by-function basis. This convention provides no guarantees about how a - callee will expect arguments to be passed, so should not be used for functions which are expected to + callee will expect arguments to be passed, so it should not be used for functions which are expected to have a stable, predictable interface. This is a good choice for local functions, or functions which are only used within an executable/library and are not part of the public interface. - `Kernel`, this is a special calling convention that is used when defining kernel modules in the IR. @@ -112,7 +112,7 @@ using intrinsics. Structures and unions assume the alignment of their most strictly aligned component. Each member is assigned to the lowest available offset with the appropriate alignment. The size of any object is always a multiple of the object's alignment. An array uses the same alignment as its elements. Structure and union objects can require padding to meet size and alignment -constraints. The contents of any padding is undefined. +constraints. The contents of any padding are undefined. ### Memory model @@ -162,7 +162,7 @@ trying to load (or encode the data we're trying to store). Because we're essentially emulating byte-addressable memory on word-addressable memory, loads/stores can range from simple and straightforward, to expensive and complicated, depending on the size and alignment of the value type. The process goes as follows: -* If the value type is word-aligned, it can be loaded/stored in as little as a single instruction depending on the size of the type +* If the value type is word-aligned, it can be loaded/stored in as few as a single instruction depending on the size of the type * Likewise if the value type is element-aligned, and the address is word-aligned * Element-aligned values require some extra instructions to load a full word and drop the unused elements (or in the case of stores, loading the full word and replacing the element being stored) @@ -260,7 +260,7 @@ in MASM parlance), but no function signature, i.e. given a MASM procedure, there many values it returns, let alone the types of arguments/return values. Instead, we're going to specify calling conventions in terms of Miden IR, which has a fairly expressive type system more or less equivalent to that of LLVM, and how that translates to Miden primitives. -Functions in Miden IR always have a signature, which specify the following: +Functions in Miden IR always have a signature, which specifies the following: * The calling convention required to call the function * The number and types of the function arguments diff --git a/docs/external/src/appendix/canonabi-adhocabi-mismatch.md b/docs/external/src/appendix/canonabi-adhocabi-mismatch.md index a83132fa8..7d319e986 100644 --- a/docs/external/src/appendix/canonabi-adhocabi-mismatch.md +++ b/docs/external/src/appendix/canonabi-adhocabi-mismatch.md @@ -17,7 +17,7 @@ ABI _transformation strategies_. ## Summary -The gist of the problem is that in Miden, the size and number of procedure results is only constrained +The gist of the problem is that in Miden, the size and number of procedure results are only constrained by the maximum addressable operand stack depth. In most programming languages, particularly those in which interop is typically performed using some variant of the C ABI (commonly the one described in the System V specification), the number of results is almost always limited to a single result, @@ -174,7 +174,7 @@ adapter_function.store(tx_kernel_func_val, ptr); adapter_function.build(); ``` -Here is how the adapter might look like in a pseudo-code for the `add_asset` function: +Here is how the adapter might look in pseudo-code for the `add_asset` function: ```wat /// Takes an Asset as an argument and returns a new Asset @@ -237,7 +237,7 @@ the return value is a list, expect the last argument in the Wasm core(HIR) signa The adapter function calls allocates `asset_count * item_size` memory via the `realloc` call and passes the pointer to the newly allocated memory to the tx kernel function. -Here is how the adapter function might look like in a pseudo-code for the `get_assets` function: +Here is how the adapter function might look in pseudo-code for the `get_assets` function: ```rust func wasm_core_get_assets(asset_count: u32, ptr_ptr: i32) { @@ -254,12 +254,12 @@ func wasm_core_get_assets(asset_count: u32, ptr_ptr: i32) { Since the `get_assets` tx kernel function in the current form can trash the provided memory if the actual assets count differs from the returned by `get_assets_count`, we can introduce the -asset count parameter to the `get_assets` tx kernel function and check that it the same as the +asset count parameter to the `get_assets` tx kernel function and check that it's the same as the actual assets count written to memory. ::: -## The example of some functions signatures +## The example of some function signatures ### `add_asset` (return-via-pointer Miden ABI pattern) diff --git a/docs/external/src/appendix/known-limitations.md b/docs/external/src/appendix/known-limitations.md index 215633b6e..d20980733 100644 --- a/docs/external/src/appendix/known-limitations.md +++ b/docs/external/src/appendix/known-limitations.md @@ -35,7 +35,7 @@ As a result, floating-point types in Rust are not supported at all. Any attempt result in a compilation error. We considered this a fair design tradeoff, as floating point math is unused/rare in the context in which Miden is used, in comparison to fixed-point or field arithmetic. In addition, implementing floating-point operations in software on the Miden VM would -be extraordinarily expensive, which generally works against the purpose for using floats in the +be extraordinarily expensive, which generally works against the purpose of using floats in the first place. At this point in time, we have no plans to support floats, but this may change if we are able to @@ -50,8 +50,8 @@ find a better/more natural representation for `Felt` in WebAssembly. This feature corresponds to `call_indirect` in WebAssembly, and is associated with Rust features such as trait objects (which use indirection to call trait methods), and closures. Note that the Rust compiler is able to erase the indirection associated with certain abstractions statically -in some cases, shown below. If Rust is unable to statically resolve all call targets, then `midenc` -will raise an error when it encounters any use of `call_indirect`. +in some cases, as shown below. If Rust is unable to statically resolve all call targets, then +`midenc` will raise an error when it encounters any use of `call_indirect`. :::warning @@ -144,7 +144,7 @@ by the compiler in some cases, and the set of procedures for which this is done restricted to a hardcoded whitelist of known Miden procedures. This affects any procedure which returns a type larger than `u32` (excluding `Felt`, which for -this purpose has the same size). For example, returing a Miden `Word` from a procedure, a common +this purpose has the same size). For example, returning a Miden `Word` from a procedure, a common return type, is not compatible with Rust's ABI - it will attempt to generate code which allocates stack space in the caller, which it expects the callee to write to, inserting a new parameter at the start of the parameter list, and expecting nothing to be returned by value. The compiler handles @@ -179,7 +179,7 @@ callee, which has the effect of requiring procedures to have a different ABI dep they expect to be dynamically-invoked or not. Our solution to that issue is to generate stubs which are used as the target of `dyn(exec|call)`, -the body of which drop the callee hash, fix up the operand stack as necessary, and then uses a +the body of which drops the callee hash, fixes up the operand stack as necessary, and then uses a simple `exec` or `call` to invoke the "real" callee. We will emit a single stub for every function which has its "address" taken, and use the hash of the stub in place of the actual callee hash. @@ -208,13 +208,13 @@ the [WebAssembly Component Model](https://component-model.bytecodealliance.org/) interest to us, is the fact that components in this model are "shared-nothing", and the ABI used to communicate across component boundaries, is specially designed to enforce shared-nothing semantics on caller and callee. In addition to compiling for a specific Wasm target, we also rely on some -additional tooling for describing component interfaces, types, and to generate Rust bindings for +additional tooling for describing component interfaces, types, and generating Rust bindings for those descriptions, to ensure that calls across the boundary remain opaque, even to the linker, which ensures that the assumptions of the caller and callee with regard to what address space they operate in are preserved (i.e. a callee can never be inlined into the caller, and thus end up executing in the caller's context rather than the expected callee context). -This is one of our top priorities, as it is critical to being able to use Rust to compile code for +This is one of our top priorities, as it is critical to be able to use Rust to compile code for the Miden rollup, but it is also the most complex feature on our roadmap, hence why it is scheduled for our Beta 2 milestone, rather than Beta 1 (the next release), as it depends on multiple other subfeatures being implemented first. diff --git a/docs/external/src/guides/debugger.md b/docs/external/src/guides/debugger.md index 9516fde2d..25b43c6f7 100644 --- a/docs/external/src/guides/debugger.md +++ b/docs/external/src/guides/debugger.md @@ -10,7 +10,7 @@ via the `midenc debug` command. :::warning -The debugger is still quite new, and while very useful already, still has a fair number of +The debugger is still quite new, and while very useful already, it still has a fair number of UX annoyances. Please report any bugs you encounter, and we'll try to get them patched ASAP! ::: @@ -44,7 +44,7 @@ options, depending on the needs of the program: ### Via command line -To specify the contents of the operand stack, you can do so following the raw arguments separator `--`. +To specify the contents of the operand stack, you can do so by following the raw arguments separator `--`. Each operand must be a valid field element value, in either decimal or hexadecimal format. For example: ```shell @@ -168,7 +168,7 @@ The syntax for each of these can be found below, in the same order (shown using | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | `b FILE[:LINE]` | Break when an instruction with a source location in `FILE` (a glob pattern)
_and_ that occur on `LINE` (literal, if provided) are hit. | | `b in NAME` | Break when the glob pattern `NAME` matches the fully-qualified procedure name
containing the current instruction | -| `b for OPCODE` | Break when the an instruction with opcode `OPCODE` is exactly matched
(including immediate values) | +| `b for OPCODE` | Break when an instruction with opcode `OPCODE` is exactly matched
(including immediate values) | | `b next` | Break on the next instruction | | `b after N` | Break after `N` cycles | | `b at CYCLE` | Break when the cycle count reaches `CYCLE`.
If `CYCLE` has already occurred, this has no effect | diff --git a/docs/external/src/guides/rust_to_wasm.md b/docs/external/src/guides/rust_to_wasm.md index dd9ba466b..1b420346e 100644 --- a/docs/external/src/guides/rust_to_wasm.md +++ b/docs/external/src/guides/rust_to_wasm.md @@ -7,7 +7,7 @@ sidebar_position: 1 This chapter will walk you through compiling a Rust crate to a WebAssembly (Wasm) module in binary (i.e. `.wasm`) form. The Miden compiler has a frontend which can take such -modules and compile them on to Miden Assembly, which will be covered in the next chapter. +modules and compile them into Miden Assembly, which will be covered in the next chapter. ## Setup diff --git a/docs/external/src/index.md b/docs/external/src/index.md index d30963961..b72dc722a 100644 --- a/docs/external/src/index.md +++ b/docs/external/src/index.md @@ -24,7 +24,7 @@ unimplemented or a known limitation, please let us know by reporting an issue on The compiler toolchain consists of the following primary components: -- An intermediate representation (IR), which can be lowered to by compiler backends wishing to +- An intermediate representation (IR), which can be lowered by compiler backends wishing to support Miden as a target. The Miden IR is an SSA IR, much like Cranelift or LLVM, providing a much simpler path from any given source language (e.g. Rust), to Miden Assembly. It is used internally by the rest of the Miden compiler suite. @@ -45,7 +45,7 @@ The compiler toolchain consists of the following primary components: - A terminal-based interactive debugger, available via `midenc debug`, which provides a UI very similar to `lldb` or `gdb` when using the TUI mode. You can use this to run a program, or step through it cycle-by-cycle. You can set various types of breakpoints; see the source code, call - stack, and contents of the operand stack at the current program point; as well as interatively + stack, and contents of the operand stack at the current program point; as well as interactively read memory and format it in various ways for display. - A Miden SDK for Rust, which provides types and bindings to functionality exported from the Miden standard library, as well as the Miden transaction kernel API. You can use this to access native diff --git a/docs/internal/src/analyses.md b/docs/internal/src/analyses.md index 5b6e3eb53..06fbff654 100644 --- a/docs/internal/src/analyses.md +++ b/docs/internal/src/analyses.md @@ -67,7 +67,7 @@ The loop forest represents the set of loops identified in a given CFG, as well a Each block may only be the header for a single loop, and thus you can identify a loop by the header block. -See [LLVM Loop Terminology (and Canonical Forms)](https://llvm.org/docs/LoopTerminology.html) for a more comprehensive description of how loops are treated analyzed by the compiler, as we base our implementation on LLVM's. +See [LLVM Loop Terminology (and Canonical Forms)](https://llvm.org/docs/LoopTerminology.html) for a more comprehensive description of how loops are treated and analyzed by the compiler, as we base our implementation on LLVM's. The loop forest can be queried for info about a particular loop, whether a block is part of a loop, and if it is a loop header. The information for a particular loop lets you query what blocks are part of the loop, what their role(s) in the loop are, and the relationship to other loops (i.e. whether the loop is a child of another loop). diff --git a/docs/internal/src/data_layout.md b/docs/internal/src/data_layout.md index 508030b92..8298db106 100644 --- a/docs/internal/src/data_layout.md +++ b/docs/internal/src/data_layout.md @@ -1,6 +1,6 @@ # Data layout -This document describes how we map data/memory accesses from the byte-addressable address space asssumed by Rust and most (if not virtually all) other languages, to the element-addressable address space of the Miden VM. +This document describes how we map data/memory accesses from the byte-addressable address space assumed by Rust and most (if not virtually all) other languages, to the element-addressable address space of the Miden VM. The details of this are abstracted away by HIR - so if you are working with Miden from Rust, or some other language that lowers to Miden Assembly via the Miden compiler's intermediate representation (HIR), it is essentially transparent. diff --git a/docs/internal/src/ir.md b/docs/internal/src/ir.md index c07638f5f..dd91da7e9 100644 --- a/docs/internal/src/ir.md +++ b/docs/internal/src/ir.md @@ -79,13 +79,13 @@ There are currently a limited set of dialects, comprising the set of operations - `arith`, i.e. _arithmetic_, which provides all of the mathematical operations we currently support lowerings for. This dialect also provides the `Constant` operation for all supported numeric types. - `cf`, i.e. _control flow_, which provides all of the unstructured control flow or control flow-adjacent operations, i.e. `Br`, `CondBr`, `Switch`, and `Select`. The latter is not strictly speaking a control flow operation, but is semantically similar. This dialect is largely converted to the `scf` dialect before lowering, with the exception of `Select`, and limited support for `CondBr` (to handle a specific edge case of the control flow lifting transformation). - `scf`, i.e. _structured control flow_, which provides structured equivalents of all the control flow we support, i.e. `If`, `While` (for both while/do and do/while loops), and `IndexSwitch` (essentially equivalent to `cf.switch`, but in structured form). The `Yield` and `Condition` operations are defined in this dialect to represent control flow within (or out of) a child region of one of the previous three ops. -- `hir` (likely to be renamed to `masm` or `vm` in the near future), which is currently used to represent the set of operations unique to the Miden VM, or correspond to compiler intrinsics implemented in Miden Assembly. +- `hir` (likely to be renamed to `masm` or `vm` in the near future), which is currently used to represent the set of operations unique to the Miden VM, or corresponds to compiler intrinsics implemented in Miden Assembly. See [_defining dialects_](#defining-dialects) for more information on what dialects are responsible for in HIR. ### Operations -An _operation_ represents a computation. Inputs to that computation are in the form of _operands_, and outputs of the computation are in the form of _results_. In practice, an operation may also have _effects_, such as reading/writing from memory, which also represent input/output of the operation, but not explicitly represented in an operation's operands and results. +An _operation_ represents a computation. Inputs to that computation are in the form of _operands_, and outputs of the computation are in the form of _results_. In practice, an operation may also have _effects_, such as reading/writing from memory, which also represent input/output of the operation, but are not explicitly represented in an operation's operands and results. Operations can contain zero or more regions. An operation with no regions is also called a _primitive_ operation; while an operation with one or more regions is called a _structured_ operation. An example of the former is the `hir.call` operation, i.e. the function call instruction. An example of the latter is `scf.if`, which represents a structured conditional control flow operation, consisting of two regions, a "then" region, and an "else" region. @@ -116,7 +116,7 @@ A _block_, or _basic block_, is a set of one or more [_operations_](#operations) Blocks belong to [_regions_](#regions), and if a block has no parent region, it is considered _orphaned_. -A block may declare _block arguments_, the only other way to introduce [_values_](#values) into the IR, aside from operation results. Predecessors of a block must ensure that they provide inputs for all block arguments when transfering control to the block. +A block may declare _block arguments_, the only other way to introduce [_values_](#values) into the IR, aside from operation results. Predecessors of a block must ensure that they provide inputs for all block arguments when transferring control to the block. Blocks which are reachable as successors of some control flow operation, are said to be _used_ by that operation. These uses are represented in the form of the `BlockOperand` type, which specifies what block is used, what operation is the user, and the index of the successor in the operation's [_successor storage_](#entity-storage). The `BlockOperand` is linked into the [_use-list_](#entity-lists) of the referenced `Block`, and a `BlockOperandRef` is stored as part of the successor information in the using operation's successor storage. This is the means by which the control flow graph is traversed - you can navigate to predecessors of a block by visiting all of its "users", and you navigate to successors of a block by visiting all successors of the block terminator operation. @@ -131,7 +131,7 @@ A _value_ represents terms in a program, temporaries created to store data as it Value _definitions_ (aka "defs") can be introduced in two ways: -1. Block argument lists, i.e. the `BlockArgument` value kind. In general, block arguments are used as a more intuitive and ergonomic representation of SSA _phi nodes_, joining multiple definitions of a single value together at control flow join points. Block arguments are also used to represent _region arguments_, which correspond to the set of values that will be forward to that region by the parent operation (or from a sibling region). These arguments are defined as block arguments of the region's entry block. A prime example of this, is the `Function` op. The parameters expressed by the function signature are reflected in the entry block argument list of the function body region. +1. Block argument lists, i.e. the `BlockArgument` value kind. In general, block arguments are used as a more intuitive and ergonomic representation of SSA _phi nodes_, joining multiple definitions of a single value together at control flow join points. Block arguments are also used to represent _region arguments_, which correspond to the set of values that will be forwarded to that region by the parent operation (or from a sibling region). These arguments are defined as block arguments of the region's entry block. A prime example of this, is the `Function` op. The parameters expressed by the function signature are reflected in the entry block argument list of the function body region. 2. Operation results, i.e. the `OpResult` value kind. This is the primary way in which values are introduced. Both value kinds above implement the `Value` trait, which provides the set of metadata and behaviors that are common across all value kinds. In general, you will almost always be working with values in terms of this trait, rather than the concrete type. @@ -144,10 +144,10 @@ As always, all _uses_ of a value must be dominated by its definition. The IR is An _operand_ is a [_value_](#values) used as an argument to an operation. -Beyond the semantics of any given operation, operand ordering is only significant in so far as it is used as the order in which those items are expected to appear on the operand stack once lowered to Miden Assembly. The earlier an operand appears in the list of operands for an operation, the +Beyond the semantics of any given operation, operand ordering is only significant insofar as it is used as the order in which those items are expected to appear on the operand stack once lowered to Miden Assembly. The earlier an operand appears in the list of operands for an operation, the closer to the top of the operand stack it will appear. -Similarly, the ordering of operand results also correlates to the operand stack order after lowering. Specifically, the earlier a result appears in the result list, the closer to the top of the operand stack it will appear after the operation executes. +Similarly, the ordering of operand results also correlates with the operand stack order after lowering. Specifically, the earlier a result appears in the result list, the closer to the top of the operand stack it will appear after the operation executes. #### Immediates @@ -268,7 +268,7 @@ We care about this when performing inter-procedural analyses, as it dictates how ## High-Level Structure -Beyond the core IR concepts introduced in the previous section, HIR also imposes some hierarchical structure to programs in form of builtin operations that are special-cased in certain respects: +Beyond the core IR concepts introduced in the previous section, HIR also imposes some hierarchical structure to programs in form of built-in operations that are special-cased in certain respects: - [Worlds](#worlds) - [Components](#components) @@ -464,7 +464,7 @@ You should always refer to the documentation associated with the types mentioned The `Session` type, provided by the `midenc-session` crate, represents all of the configuration for the current compilation _session_, i.e. invocation. -A session begins by providing the compiler driver with some inputs, user-configurable flags/options, and intrumentation handler. A session ends when those inputs have been compiled to some output, and the driver exits. +A session begins by providing the compiler driver with some inputs, user-configurable flags/options, and instrumentation handler. A session ends when those inputs have been compiled to some output, and the driver exits. ### Context @@ -532,7 +532,7 @@ Examples include: - The list of operands using a block argument/op result - The list of symbol users referencing a symbol -In conjunction with the list itself, there are a set of traits which facilitate automatically maintaining the relationship between parent and child entity as items are inserted, removed, or transferred between parent lists: +In conjunction with the list itself, there is a set of traits which facilitate automatically maintaining the relationship between parent and child entity as items are inserted, removed, or transferred between parent lists: - `EntityParent`, implemented by any entity type which has some child entity of type `Child`. This provides us with the ability to map a parent/child relationship to the offset of the intrusive linked list in the parent entity, so that we can construct a reference to it. Entities can be the parent of multiple other entity types. - `EntityWithParent`, implemented by the child entity which has some parent type `T`, this provides the inverse of `EntityParent`, i.e. the ability for the entity list infrastructure to resolve the parent type of a child entity it stores, and given a reference to the parent entity, get the relevant intrusive list for that child. Entities with a parent may only have a single parent entity type at this time. @@ -562,7 +562,7 @@ Another thing to be aware of, is that relationships between entities where there - `BlockOperand` represents a "use" of a `Block` by an operation as a successor. This type is responsible for forming the edges of the CFG, and so much like `OpOperand`, the `Block` type has an entity list for `BlockOperand`s, effectively the set of that block's predecessors; while the operation has entity storage for `BlockOperandRefs` (or more precisely, `SuccessorInfo`, of which `BlockOperandRef` is one part). - `SymbolUse` represents a use of a `Symbol` by an operation. This underpins the maintenance of the call graph. Unlike operands, symbol usage is not tracked as a fundamental part of every operation, i.e. there is no dedicated `symbols` field of the `Operation` type which provides the entity storage for `SymbolUseRef`s, nor is there a field which defines the entity list. Instead, the symbol use list of an op that implements `Symbol`, must be defined as part of the concrete operation type. Similarly, any concrete operation type that can use/reference a `Symbol` op, must determine for itself how it will store that use. For this reason, symbol maintenance is a bit less ergonomic than other entity types. -We now can explore the different means by which the IR can be traversed: +We can now explore the different means by which the IR can be traversed: 1. Using the raw traversal primitives described above. 2. The `Graph` trait @@ -584,7 +584,7 @@ The `Walk` trait defines how to walk all children of a given type, which are con The difference between `Walk` and `RawWalk`, is that `Walk` requires borrowed references to the types it is implemented for, while `RawWalk` relies on the traversal primitives we introduced at the start of this section, to avoid borrowing any of the entities being traversed, with the sole exception being to access child entity lists long enough to get a reference to the head of the list. If we are ever mutating the IR as we visit it, then we use `RawWalk`, otherwise `Walk` tends to be more ergonomic. -The `Walk` and `RawWalk` traits provide both pre- and post-order traversals, which dictates in what order the visit callback is invoked. You can further dictate the direction in which the children are visited, e.g. are operations of a block visited forward (top-down), or backward (bottom-up)? Lastly, if you wish to be able to break out of a traversal early, the traits provide variants of all functions which allow the visit callback to return a `WalkResult` that dictates whether to continue the traversal, skip the children of the current node, or abort the traversal with an error. +The `Walk` and `RawWalk` traits provide both pre- and post-order traversals, which dictate in what order the visit callback is invoked. You can further dictate the direction in which the children are visited, e.g. are operations of a block visited forward (top-down), or backward (bottom-up)? Lastly, if you wish to be able to break out of a traversal early, the traits provide variants of all functions which allow the visit callback to return a `WalkResult` that dictates whether to continue the traversal, skip the children of the current node, or abort the traversal with an error. #### `CallOpInterface` and `CallableOpInterface` @@ -622,7 +622,7 @@ Currently, we distinguish the points representing "before" a block (i.e. at the The `ProgramPoint` type can be reified as a literal cursor into the operation list of a block, and then used to perform some action relative to that cursor. -The key thing to understand about program points has to do with the relationship between before/after (or start/end) and what location that actually refers to. The gist, is that a program point, when materialized as a cursor into an operation list, will always have the cursor positioned such that if you inserted a new operation at that point, it would be placed where you expect it to be - i.e. if "before" an operation, the insertion will place the new item immediately preceding the operation referenced by the program point. This is of particular importance if inserting multiple operations using the same point, as the order in which operations will be inserted depends on whether the position is before or after the point. For example, inserting multiple items "before" an operation, will have them appear in that same order in the containing block. However, inserting multiple items "after" an operation, will have them appear in reverse order they were inserted (i.e. the last to be inserted will appear first in the block relative to the others). +The key thing to understand about program points has to do with the relationship between before/after (or start/end) and the location that actually refers to. The gist, is that a program point, when materialized as a cursor into an operation list, will always have the cursor positioned such that if you inserted a new operation at that point, it would be placed where you expect it to be - i.e. if "before" an operation, the insertion will place the new item immediately preceding the operation referenced by the program point. This is of particular importance if inserting multiple operations using the same point, as the order in which operations will be inserted depends on whether the position is before or after the point. For example, inserting multiple items "before" an operation, will have them appear in that same order in the containing block. However, inserting multiple items "after" an operation, will have them appear in reverse order they were inserted (i.e. the last to be inserted will appear first in the block relative to the others). ### Defining Dialects @@ -793,7 +793,7 @@ It should be noted that the choice to implement `EffectOpInterface` for an opera For example, most operations will have a known effect (or lack thereof) on memory, e.g. `arith.add` will never have a memory effect, while `hir.load` by definition will read from memory. In some cases, whether an operation will have such an effect is not a property of the operation itself, but rather operations that may be nested in one of its child regions, e.g. `scf.if` has no memory effects in and of itself, but one of its regions might contain an operation which does, such as an `hir.store` in the "then" region. In this case, it does not make sense for `scf.if` to implement `EffectOpInterface`, because memory effects are not specified for `scf.if`, but are instead derived from its regions. -When `EffectOpInterface` is not implemented for some operation, then one must treat the operation as conservatively as possible in regards to the specific effect. For example, `scf.call` does not implement this interface for `MemoryEffect`, because whether the call has any memory effects depends on the function being called. As a result, one must assume that the `scf.call` could have any possible memory effect, unless you are able to prove otherwise using inter-procedural analysis. +When `EffectOpInterface` is not implemented for some operation, then one must treat the operation as conservatively as possible regarding the specific effect. For example, `scf.call` does not implement this interface for `MemoryEffect`, because whether the call has any memory effects depends on the function being called. As a result, one must assume that the `scf.call` could have any possible memory effect, unless you are able to prove otherwise using inter-procedural analysis. #### Memory Effects @@ -804,4 +804,4 @@ The infrastructure described above can be used to represent any manner of side e - The `HasRecursiveMemoryEffects` trait, which should be implemented on any operation whose regions may contain operations that have memory effects. - The `Operation::is_memory_effect_free` method, which returns a boolean indicating whether the operation is known not to have any memory effects. -In most places, we're largely concerned with whether an operation is known to be memory effect free, thus allowing us to move that operation around freely. We have not started doing more sophisticated effect analysis and optimizations based on such analysis. +In most places, we're largely concerned with whether an operation is known to be memory effect-free, thus allowing us to move that operation around freely. We have not started doing more sophisticated effect analysis and optimizations based on such analysis. From fa94e79f4dc5f32af1554fad0dcbf3d73eac804e Mon Sep 17 00:00:00 2001 From: MozirDmitriy Date: Thu, 18 Dec 2025 22:24:50 +0300 Subject: [PATCH 67/70] fix: DomTreeSuccessorIter::next_back bounds handling --- hir/src/ir/dominance/tree.rs | 51 ++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/hir/src/ir/dominance/tree.rs b/hir/src/ir/dominance/tree.rs index 8e58aa838..77f44c094 100644 --- a/hir/src/ir/dominance/tree.rs +++ b/hir/src/ir/dominance/tree.rs @@ -219,11 +219,11 @@ impl Iterator for DomTreeSuccessorIter { } impl DoubleEndedIterator for DomTreeSuccessorIter { fn next_back(&mut self) -> Option { - if self.num_children == 0 { + if self.index >= self.num_children { return None; } - let index = self.num_children; self.num_children -= 1; + let index = self.num_children; Some(self.node.children.borrow()[index].clone()) } } @@ -1028,3 +1028,50 @@ impl PartialEq for DomTreeBase { }) } } + +#[cfg(test)] +mod tests { + use alloc::rc::Rc; + + use super::*; + + #[test] + fn dom_tree_successor_iter_forwards_backwards_and_mixed() { + let root = Rc::new(DomTreeNode::new(None, None)); + let c0 = Rc::new(DomTreeNode::new(None, Some(root.clone()))); + let c1 = Rc::new(DomTreeNode::new(None, Some(root.clone()))); + let c2 = Rc::new(DomTreeNode::new(None, Some(root.clone()))); + + root.add_child(c0.clone()); + root.add_child(c1.clone()); + root.add_child(c2.clone()); + + let mut iter = DomTreeSuccessorIter::new(root.clone()); + let first = iter.next().unwrap(); + let second = iter.next().unwrap(); + let third = iter.next().unwrap(); + assert!(Rc::ptr_eq(&first, &c0)); + assert!(Rc::ptr_eq(&second, &c1)); + assert!(Rc::ptr_eq(&third, &c2)); + assert!(iter.next().is_none()); + + let mut iter = DomTreeSuccessorIter::new(root.clone()); + let last = iter.next_back().unwrap(); + let mid = iter.next_back().unwrap(); + let first_back = iter.next_back().unwrap(); + assert!(Rc::ptr_eq(&last, &c2)); + assert!(Rc::ptr_eq(&mid, &c1)); + assert!(Rc::ptr_eq(&first_back, &c0)); + assert!(iter.next_back().is_none()); + + let mut iter = DomTreeSuccessorIter::new(root); + let first = iter.next().unwrap(); + let last = iter.next_back().unwrap(); + let middle = iter.next().unwrap(); + assert!(Rc::ptr_eq(&first, &c0)); + assert!(Rc::ptr_eq(&last, &c2)); + assert!(Rc::ptr_eq(&middle, &c1)); + assert!(iter.next().is_none()); + assert!(iter.next_back().is_none()); + } +} From 654c28c8f073a95b13faf533419647400fc2f3e1 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 23 Dec 2025 11:25:17 +0200 Subject: [PATCH 68/70] chore: bump SDK version to `v0.8.0`, update CHANGELOG --- Cargo.lock | 12 ++++++------ sdk/alloc/Cargo.toml | 2 +- sdk/base-macros/Cargo.toml | 2 +- sdk/base-sys/Cargo.toml | 4 ++-- sdk/base/Cargo.toml | 6 +++--- sdk/sdk/CHANGELOG.md | 11 +++++++++++ sdk/sdk/Cargo.toml | 10 +++++----- sdk/stdlib-sys/Cargo.toml | 2 +- 8 files changed, 30 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7496c9ba8..e9be913d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2171,7 +2171,7 @@ dependencies = [ [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -2240,7 +2240,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -2255,7 +2255,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -2663,7 +2663,7 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib" @@ -2683,7 +2683,7 @@ dependencies = [ [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-thiserror" diff --git a/sdk/alloc/Cargo.toml b/sdk/alloc/Cargo.toml index 1fe399400..5fd8fcd75 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.7.0" +version = "0.8.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 ec6813973..186dbd5d1 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.7.1" +version = "0.8.0" rust-version.workspace = true authors.workspace = true repository.workspace = true diff --git a/sdk/base-sys/Cargo.toml b/sdk/base-sys/Cargo.toml index 2d726a328..a8e33240d 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.0" +version = "0.8.1" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -16,7 +16,7 @@ build = "build.rs" links = "miden_base_sys_stubs" [dependencies] -miden-stdlib-sys = { version = "0.7.1", path = "../stdlib-sys" } +miden-stdlib-sys = { version = "0.8.0", path = "../stdlib-sys" } [features] default = [] diff --git a/sdk/base/Cargo.toml b/sdk/base/Cargo.toml index c8f185f7b..c340f6400 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.7.1" +version = "0.8.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -13,8 +13,8 @@ edition.workspace = true [dependencies] miden-base-sys = { version = "0.8.0", path = "../base-sys" } -miden-stdlib-sys = { version = "0.7.1", path = "../stdlib-sys" } -miden-base-macros = { version = "0.7.1", path = "../base-macros" } +miden-stdlib-sys = { version = "0.8.0", path = "../stdlib-sys" } +miden-base-macros = { version = "0.8.0", path = "../base-macros" } [features] default = [] diff --git a/sdk/sdk/CHANGELOG.md b/sdk/sdk/CHANGELOG.md index 7ebaa80e4..9928d634e 100644 --- a/sdk/sdk/CHANGELOG.md +++ b/sdk/sdk/CHANGELOG.md @@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0] + +### BREAKING +- Require `&mut` in mutating methods of the account storage; + +### Added + +- 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 + ## [0.7.1](https://github.com/0xMiden/compiler/compare/miden-v0.7.0...miden-v0.7.1) - 2025-11-13 ### Other diff --git a/sdk/sdk/Cargo.toml b/sdk/sdk/Cargo.toml index b1defa50f..21c71d859 100644 --- a/sdk/sdk/Cargo.toml +++ b/sdk/sdk/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden" description = "Miden SDK" -version = "0.7.1" +version = "0.8.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -15,10 +15,10 @@ edition.workspace = true crate-type = ["rlib"] [dependencies] -miden-sdk-alloc = { version = "0.7.0", path = "../alloc" } -miden-stdlib-sys = { version = "0.7.1", path = "../stdlib-sys" } -miden-base = { version = "0.7.1", path = "../base" } -miden-base-sys = { version = "0.8.0", path = "../base-sys" } +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" } wit-bindgen = { version = "0.46", default-features = false, features = ["macros"] } [features] diff --git a/sdk/stdlib-sys/Cargo.toml b/sdk/stdlib-sys/Cargo.toml index 70a7fd337..9b9ac83e4 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.7.1" +version = "0.8.0" rust-version.workspace = true authors.workspace = true repository.workspace = true From d71079220577691c1649dfcf6cb4d4d2ae468d90 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 23 Dec 2025 17:35:17 +0200 Subject: [PATCH 69/70] chore: update git tags in `cargo miden new` command --- tools/cargo-miden/src/commands/new_project.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index 3a4b46155..62434e651 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.23.0"; +const PROJECT_TEMPLATES_REPO_TAG: &str = "v0.24.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.6"; +const MIDEN_PROJECT_TEMPLATE_REPO_TAG: &str = "v0.7"; // This should have been an enum but I could not bend `clap` to expose variants as flags /// Project template From b6726c0870f2030a7c8269c896e499b0c1fb3c99 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 23 Dec 2025 18:03:09 +0200 Subject: [PATCH 70/70] chore: updated Cargo.lock for `miden` v0.8 --- examples/auth-component-no-auth/Cargo.lock | 12 ++++++------ examples/auth-component-rpo-falcon512/Cargo.lock | 12 ++++++------ examples/basic-wallet-tx-script/Cargo.lock | 12 ++++++------ examples/basic-wallet/Cargo.lock | 12 ++++++------ examples/counter-contract/Cargo.lock | 12 ++++++------ examples/counter-note/Cargo.lock | 12 ++++++------ examples/p2id-note/Cargo.lock | 12 ++++++------ examples/p2ide-note/Cargo.lock | 12 ++++++------ examples/storage-example/Cargo.lock | 12 ++++++------ tests/rust-apps-wasm/rust-sdk/add/Cargo.lock | 12 ++++++------ .../rust-sdk/component-macros-account/Cargo.lock | 12 ++++++------ .../rust-sdk/component-macros-note/Cargo.lock | 12 ++++++------ .../rust-sdk/cross-ctx-account-word-arg/Cargo.lock | 12 ++++++------ .../rust-sdk/cross-ctx-account-word/Cargo.lock | 12 ++++++------ .../rust-sdk/cross-ctx-account/Cargo.lock | 12 ++++++------ .../rust-sdk/cross-ctx-note-word-arg/Cargo.lock | 12 ++++++------ .../rust-sdk/cross-ctx-note-word/Cargo.lock | 12 ++++++------ .../rust-sdk/cross-ctx-note/Cargo.lock | 12 ++++++------ 18 files changed, 108 insertions(+), 108 deletions(-) diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index 1347cb036..474f5bc13 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -803,7 +803,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -862,7 +862,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -871,7 +871,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -886,7 +886,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1064,11 +1064,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/auth-component-rpo-falcon512/Cargo.lock b/examples/auth-component-rpo-falcon512/Cargo.lock index f0f96bb0a..9c5d77b2d 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.lock +++ b/examples/auth-component-rpo-falcon512/Cargo.lock @@ -804,7 +804,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -863,7 +863,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -872,7 +872,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -887,7 +887,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1065,11 +1065,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index b61a55f38..7266adbe7 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index 9b9ed7fe5..af9344a0f 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index e6f8437f5..4ebbd7848 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index 9d5bc2547..d24f7f6a5 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index 8739e9261..10eb9225d 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -789,7 +789,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -848,7 +848,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -857,7 +857,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -872,7 +872,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1050,11 +1050,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index 3c5c6af45..d089ccfe0 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -986,7 +986,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -1046,7 +1046,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -1055,7 +1055,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -1070,7 +1070,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1258,7 +1258,7 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib" @@ -1278,7 +1278,7 @@ dependencies = [ [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 10fdfef34..1567751f5 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -789,7 +789,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -848,7 +848,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -857,7 +857,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -872,7 +872,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1050,11 +1050,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index 5891e0a4a..7b72aa6d5 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -789,7 +789,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -848,7 +848,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -857,7 +857,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -872,7 +872,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1050,11 +1050,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 7dc8f3d9e..39ee83072 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 @@ -809,7 +809,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -868,7 +868,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -892,7 +892,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1070,11 +1070,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 a81a3cfa8..46bf528d9 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 @@ -809,7 +809,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -868,7 +868,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -877,7 +877,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -892,7 +892,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1070,11 +1070,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 22ceac4c7..a1b2c5078 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 8a552f1c8..1f6e0f348 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 430ae8693..24af5ffb9 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 2a5e8e74b..f640057d4 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 2374b4622..45463b09a 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics" 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 bd187420d..84766fb81 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 @@ -796,7 +796,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base", "miden-base-sys", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -864,7 +864,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" dependencies = [ "heck", "miden-objects", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" dependencies = [ "miden-stdlib-sys", ] @@ -1057,11 +1057,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" [[package]] name = "miden-utils-diagnostics"