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..c275d5212 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" @@ -38,14 +38,14 @@ categories = ["compilers"] keywords = ["compiler", "miden"] license = "MIT" readme = "README.md" -edition = "2021" +edition = "2024" publish = false [workspace.dependencies] 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..a88ee388f 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, criterion_group, criterion_main}; use midenc_benchmark_runner::BenchmarkRunner; fn bench_is_prime_compilation(c: &mut Criterion) { 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/artifact.rs b/codegen/masm/src/artifact.rs index c29c6415b..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, @@ -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/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 846a88086..4cba3d36e 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)] @@ -21,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/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/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/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/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/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/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/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/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/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/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/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 d9dff2d70..f79c83724 100644 --- a/eval/src/evaluator/frame.rs +++ b/eval/src/evaluator/frame.rs @@ -1,12 +1,14 @@ +#![expect(unused_assignments)] + 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 b74e0f83a..2d4cf0f2c 100644 --- a/eval/src/evaluator/memory.rs +++ b/eval/src/evaluator/memory.rs @@ -1,9 +1,11 @@ +#![expect(unused_assignments)] + use alloc::{format, string::String, vec, vec::Vec}; 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/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-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/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/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/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-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/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/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/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/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..b65f156dc 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,14 +19,20 @@ 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 // // 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-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/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/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/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/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..f6228c3ff 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,20 +13,26 @@ // 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 // // 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/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..4cb8cdfac 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 { @@ -28,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/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/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/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/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/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/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/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/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/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/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.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/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/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/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/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/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/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-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/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-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/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-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/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/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/adt/smalldeque.rs b/hir/src/adt/smalldeque.rs index 62c24b485..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}, }; @@ -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 @@ -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/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/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/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/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.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/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/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/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.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/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/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/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 3915da1f3..8947f4dde 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, @@ -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/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/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/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 db68699fa..cc4e8548c 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; @@ -6,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::{ @@ -159,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.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/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/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 c72e544d9..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; @@ -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/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 51f0af058..451846177 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)] @@ -54,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; @@ -84,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/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/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/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-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-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 ee15c6598..457e57c45 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, @@ -10,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/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/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-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/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/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/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 a9287caab..43a2f7015 100644 --- a/sdk/alloc/build.rs +++ b/sdk/alloc/build.rs @@ -40,15 +40,13 @@ 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) .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/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/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/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-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/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-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-sys/build.rs b/sdk/base-sys/build.rs index cbfeced69..0377be1c1 100644 --- a/sdk/base-sys/build.rs +++ b/sdk/base-sys/build.rs @@ -78,15 +78,13 @@ 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) .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-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/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/build.rs b/sdk/stdlib-sys/build.rs index 6aaecad41..33a79fee1 100644 --- a/sdk/stdlib-sys/build.rs +++ b/sdk/stdlib-sys/build.rs @@ -84,15 +84,13 @@ 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) .arg("-C") .arg("opt-level=1") .arg("-C") - .arg("panic=abort") - .arg("-C") .arg("codegen-units=1") .arg("-C") .arg("debuginfo=0") @@ -113,15 +111,13 @@ 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) .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/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/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/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/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/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-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/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 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/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/compiler_test.rs b/tests/integration/src/compiler_test.rs index e94a4bb79..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}; @@ -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(), @@ -274,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()); } } @@ -509,13 +508,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} "# ); @@ -549,7 +555,7 @@ impl CompilerTestBuilder { [package] name = "{name}" version = "0.0.1" - edition = "2021" + edition = "2024" authors = [] [dependencies] @@ -577,23 +583,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} "# @@ -625,7 +636,7 @@ impl CompilerTestBuilder { [package] name = "{name}" version = "0.0.1" - edition = "2021" + edition = "2024" authors = [] [dependencies] @@ -651,6 +662,7 @@ impl CompilerTestBuilder { format!( r#"#![no_std] #![no_main] +#![feature(alloc_error_handler)] #![allow(unused_imports)] #[panic_handler] @@ -658,6 +670,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(); @@ -686,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) } } @@ -866,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/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/apps.rs b/tests/integration/src/rust_masm_tests/apps.rs index 167718c1e..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] @@ -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,15 +68,21 @@ 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] + #[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) } @@ -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,10 +122,16 @@ 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}; - #[no_mangle] + #[unsafe(no_mangle)] pub fn entrypoint(a: u32) -> Vec { vec![a*2] } @@ -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,13 +167,19 @@ 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(); 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/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/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 4b7274036..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 @@ -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::*; @@ -25,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 447182040..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 @@ -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::*; @@ -25,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 c38e2e7bd..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 @@ -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::*; @@ -25,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 1744cc916..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 @@ -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::*; @@ -27,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 7a7a95e11..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 @@ -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::*; @@ -23,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 659e52550..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 @@ -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::*; @@ -27,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 326ad3726..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 @@ -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::*; @@ -23,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 fc0b5036d..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] @@ -94,6 +94,7 @@ debug = false ); let lib_rs = r#"#![no_std] +#![feature(alloc_error_handler)] use miden::*; 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/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/integration/src/testing/eval.rs b/tests/integration/src/testing/eval.rs index c0a6b1f56..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::*; @@ -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() { @@ -151,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/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.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/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 fa1d186b8..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 @@ -1,3 +1,6 @@ +#![no_std] +#![feature(alloc_error_handler)] + extern crate alloc; use miden::*; @@ -8,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 { @@ -51,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() { @@ -61,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 dade07487..35b65b1d4 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,9 +12,15 @@ 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] +#[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-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/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/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/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-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/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-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/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-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/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-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/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-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/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/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/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..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", - "build-std-features=panic_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 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..3a4b46155 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -7,13 +7,19 @@ 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. +/// 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.22.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() }, }, @@ -282,10 +288,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/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; diff --git a/tools/cargo-miden/tests/build.rs b/tools/cargo-miden/tests/build.rs index afe9f172a..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; @@ -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 @@ -40,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 @@ -438,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(_)) {