diff --git a/Cargo.lock b/Cargo.lock index 8f83c3a..0edee9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arrayvec" @@ -196,17 +196,18 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] name = "cc" -version = "1.1.10" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -217,9 +218,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.15" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -227,9 +228,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -239,14 +240,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -282,9 +283,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -310,9 +311,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "273dcfd3acd4e1e276af13ed2a43eea7001318823e7a726a6b3ed39b4acc0b82" +checksum = "54ccead7d199d584d139148b04b4a368d1ec7556a1d9ea2548febb1b9d49f9a4" dependencies = [ "cc", "cxxbridge-flags", @@ -322,9 +323,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b2766fbd92be34e9ed143898fce6c572dc009de39506ed6903e5a05b68914e" +checksum = "c77953e99f01508f89f55c494bfa867171ef3a6c8cea03d26975368f2121a5c1" dependencies = [ "cc", "codespan-reporting", @@ -332,24 +333,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] name = "cxxbridge-flags" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "839fcd5e43464614ffaa989eaf1c139ef1f0c51672a1ed08023307fa1b909ccd" +checksum = "65777e06cc48f0cb0152024c77d6cf9e4bdb4408e7b48bea993d42fa0f5b02b6" [[package]] name = "cxxbridge-macro" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2c1c1776b986979be68bb2285da855f8d8a35851a769fca8740df7c3d07877" +checksum = "98532a60dedaebc4848cb2cba5023337cc9ea3af16a5b062633fabfd9f18fb60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -416,9 +417,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "generic-array" @@ -458,15 +459,6 @@ dependencies = [ "serde", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.1" @@ -487,7 +479,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "ic-wasm" -version = "0.8.6" +version = "0.9.0" dependencies = [ "anyhow", "assert_cmd", @@ -534,9 +526,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -578,9 +570,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libflate" @@ -723,18 +715,18 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" dependencies = [ "cc", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -759,9 +751,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags", "errno", @@ -796,9 +788,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.207" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -814,20 +806,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.207" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -846,6 +838,12 @@ dependencies = [ "digest", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -854,15 +852,15 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stacker" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" dependencies = [ "cc", "cfg-if", "libc", "psm", - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -903,9 +901,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -942,22 +940,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -974,21 +972,15 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-segmentation" -version = "1.11.0" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "utf8parse" @@ -1013,9 +1005,9 @@ dependencies = [ [[package]] name = "walrus" -version = "0.21.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467611cafbc8a84834b77d2b4bb191fd2f5769752def8340407e924390c6883b" +checksum = "d68aa3c7b80be75c8458fc087453e5a31a226cfffede2e9b932393b2ea1c624a" dependencies = [ "anyhow", "gimli", @@ -1029,14 +1021,14 @@ dependencies = [ [[package]] name = "walrus-macro" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7" +checksum = "439ad39ff894c43c9649fa724cdde9a6fc50b855d517ef071a93e5df82fe51d3" dependencies = [ - "heck 0.3.3", + "heck 0.5.0", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.77", ] [[package]] @@ -1097,27 +1089,11 @@ dependencies = [ "ahash", "bitflags", "hashbrown 0.14.5", - "indexmap 2.4.0", + "indexmap 2.5.0", "semver", "serde", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" version = "0.1.9" @@ -1127,12 +1103,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-sys" version = "0.52.0" @@ -1232,5 +1202,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] diff --git a/Cargo.toml b/Cargo.toml index e9c9392..fd74925 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ic-wasm" -version = "0.8.6" +version = "0.9.0" authors = ["DFINITY Stiftung"] edition = "2021" description = "A library for performing Wasm transformations specific to canisters running on the Internet Computer" @@ -20,7 +20,7 @@ required-features = ["exe"] [dependencies] # Major version bump of walrus should result in a major version bump of ic-wasm. # Because we expose walrus types in ic-wasm public API. -walrus = "0.21.1" +walrus = "0.22.0" candid = "0.10" rustc-demangle = "0.1" thiserror = "1.0.35" diff --git a/src/bin/main.rs b/src/bin/main.rs index bd3b507..cef7dc4 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -90,7 +90,7 @@ enum SubCommand { trace_only: Option>, /// If the canister preallocates a stable memory region, specify the starting page. Required if you want to profile upgrades, or the canister uses stable memory #[clap(short, long)] - start_page: Option, + start_page: Option, /// The number of pages of the preallocated stable memory #[clap(short, long, requires("start_page"))] page_limit: Option, diff --git a/src/instrumentation.rs b/src/instrumentation.rs index 3278073..ec9163c 100644 --- a/src/instrumentation.rs +++ b/src/instrumentation.rs @@ -36,23 +36,23 @@ struct Variables { pub struct Config { pub trace_only_funcs: Vec, - pub start_address: Option, + pub start_address: Option, pub page_limit: Option, } impl Config { pub fn is_preallocated(&self) -> bool { self.start_address.is_some() } - pub fn log_start_address(&self) -> i32 { - self.start_address.unwrap_or(0) + METADATA_SIZE + pub fn log_start_address(&self) -> i64 { + self.start_address.unwrap_or(0) + METADATA_SIZE as i64 } - pub fn metadata_start_address(&self) -> i32 { + pub fn metadata_start_address(&self) -> i64 { self.start_address.unwrap_or(0) } - pub fn page_limit(&self) -> i32 { + pub fn page_limit(&self) -> i64 { self.page_limit .map(|x| x - 1) - .unwrap_or(DEFAULT_PAGE_LIMIT - 1) // minus 1 because of metadata + .unwrap_or(DEFAULT_PAGE_LIMIT - 1) as i64 // minus 1 because of metadata } } @@ -440,26 +440,26 @@ fn make_dynamic_counter64( builder.finish(vec![size], &mut m.funcs) } fn make_stable_writer(m: &mut Module, vars: &Variables, config: &Config) -> FunctionId { - let writer = get_ic_func_id(m, "stable_write"); - let grow = get_ic_func_id(m, "stable_grow"); + let writer = get_ic_func_id(m, "stable64_write"); + let grow = get_ic_func_id(m, "stable64_grow"); let mut builder = FunctionBuilder::new( &mut m.types, - &[ValType::I32, ValType::I32, ValType::I32], + &[ValType::I64, ValType::I64, ValType::I64], &[], ); let start_address = config.log_start_address(); let size_limit = config.page_limit() * 65536; let is_preallocated = config.is_preallocated(); - let offset = m.locals.add(ValType::I32); - let src = m.locals.add(ValType::I32); - let size = m.locals.add(ValType::I32); + let offset = m.locals.add(ValType::I64); + let src = m.locals.add(ValType::I64); + let size = m.locals.add(ValType::I64); builder .func_body() .local_get(offset) .local_get(size) - .binop(BinaryOp::I32Add); + .binop(BinaryOp::I64Add); if is_preallocated { - builder.func_body().i32_const(size_limit); + builder.func_body().i64_const(size_limit); } else { builder .func_body() @@ -467,11 +467,12 @@ fn make_stable_writer(m: &mut Module, vars: &Variables, config: &Config) -> Func .i32_const(65536) .binop(BinaryOp::I32Mul) .i32_const(METADATA_SIZE) - .binop(BinaryOp::I32Sub); + .binop(BinaryOp::I32Sub) + .unop(UnaryOp::I64ExtendUI32); } builder .func_body() - .binop(BinaryOp::I32GtS) + .binop(BinaryOp::I64GtS) .if_else( None, |then| { @@ -489,7 +490,7 @@ fn make_stable_writer(m: &mut Module, vars: &Variables, config: &Config) -> Func }, |else_| { else_ - .i32_const(1) + .i64_const(1) .call(grow) .drop() .global_get(vars.page_size) @@ -502,9 +503,9 @@ fn make_stable_writer(m: &mut Module, vars: &Variables, config: &Config) -> Func }, |_| {}, ) - .i32_const(start_address) + .i64_const(start_address) .local_get(offset) - .binop(BinaryOp::I32Add) + .binop(BinaryOp::I64Add) .local_get(src) .local_get(size) .call(writer) @@ -544,10 +545,11 @@ fn make_printer(m: &mut Module, vars: &Variables, writer: FunctionId) -> Functio .global_get(vars.total_counter) .store(memory, StoreKind::I64 { atomic: false }, MemArg { offset: 0, align: 8 }) .global_get(vars.log_size) - .i32_const(LOG_ITEM_SIZE) - .binop(BinaryOp::I32Mul) - .i32_const(0) - .i32_const(LOG_ITEM_SIZE) + .unop(UnaryOp::I64ExtendUI32) + .i64_const(LOG_ITEM_SIZE as i64) + .binop(BinaryOp::I64Mul) + .i64_const(0) + .i64_const(LOG_ITEM_SIZE as i64) .call(writer) // restore memory .i32_const(0) @@ -617,7 +619,7 @@ fn inject_init(m: &mut Module, is_init: GlobalId) { builder.i32_const(0).global_set(is_init); } fn inject_pre_upgrade(m: &mut Module, vars: &Variables, config: &Config) { - let writer = get_ic_func_id(m, "stable_write"); + let writer = get_ic_func_id(m, "stable64_write"); let memory = get_memory_id(m); let a = m.locals.add(ValType::I64); let b = m.locals.add(ValType::I64); @@ -651,9 +653,9 @@ fn inject_pre_upgrade(m: &mut Module, vars: &Variables, config: &Config) { .i32_const(20) .global_get(vars.is_entry) .store(memory, StoreKind::I32 { atomic: false }, MemArg { offset: 0, align: 4 }) - .i32_const(config.metadata_start_address()) - .i32_const(0) - .i32_const(METADATA_SIZE) + .i64_const(config.metadata_start_address()) + .i64_const(0) + .i64_const(METADATA_SIZE as i64) .call(writer) // restore memory .i32_const(0) @@ -667,7 +669,7 @@ fn inject_pre_upgrade(m: &mut Module, vars: &Variables, config: &Config) { .store(memory, StoreKind::I64 { atomic: false }, MemArg { offset: 0, align: 8 }); } fn inject_post_upgrade(m: &mut Module, vars: &Variables, config: &Config) { - let reader = get_ic_func_id(m, "stable_read"); + let reader = get_ic_func_id(m, "stable64_read"); let memory = get_memory_id(m); let a = m.locals.add(ValType::I64); let b = m.locals.add(ValType::I64); @@ -686,9 +688,9 @@ fn inject_post_upgrade(m: &mut Module, vars: &Variables, config: &Config) { Load { memory, kind: LoadKind::I64 { atomic: false }, arg: MemArg { offset: 0, align: 8 } }.into(), LocalSet { local: c }.into(), // load from stable memory - Const { value: Value::I32(0) }.into(), - Const { value: Value::I32(config.metadata_start_address()) }.into(), - Const { value: Value::I32(METADATA_SIZE) }.into(), + Const { value: Value::I64(0) }.into(), + Const { value: Value::I64(config.metadata_start_address()) }.into(), + Const { value: Value::I64(METADATA_SIZE as i64) }.into(), Call { func: reader }.into(), Const { value: Value::I32(0) }.into(), Load { memory, kind: LoadKind::I64 { atomic: false }, arg: MemArg { offset: 0, align: 8 } }.into(), @@ -725,7 +727,7 @@ fn make_stable_getter(m: &mut Module, vars: &Variables, leb: FunctionId, config: let reply_data = get_ic_func_id(m, "msg_reply_data_append"); let reply = get_ic_func_id(m, "msg_reply"); let trap = get_ic_func_id(m, "trap"); - let reader = get_ic_func_id(m, "stable_read"); + let reader = get_ic_func_id(m, "stable64_read"); let idx = m.locals.add(ValType::I32); let len = m.locals.add(ValType::I32); let next_idx = m.locals.add(ValType::I32); @@ -808,15 +810,15 @@ fn make_stable_getter(m: &mut Module, vars: &Variables, leb: FunctionId, config: .i32_const(5) .call(reply_data) // read stable logs - .i32_const(0) - .i32_const(config.log_start_address()) + .i64_const(0) + .i64_const(config.log_start_address()) .local_get(idx) - .i32_const(LOG_ITEM_SIZE) - .binop(BinaryOp::I32Mul) - .binop(BinaryOp::I32Add) + .i64_const(LOG_ITEM_SIZE as i64) + .binop(BinaryOp::I64Mul) + .binop(BinaryOp::I64Add) .local_get(len) - .i32_const(LOG_ITEM_SIZE) - .binop(BinaryOp::I32Mul) + .i64_const(LOG_ITEM_SIZE as i64) + .binop(BinaryOp::I64Mul) .call(reader) .i32_const(0) .local_get(len) diff --git a/tests/ok/motoko-gc-instrument.wasm b/tests/ok/motoko-gc-instrument.wasm index f1476cc..d7566f4 100644 Binary files a/tests/ok/motoko-gc-instrument.wasm and b/tests/ok/motoko-gc-instrument.wasm differ diff --git a/tests/ok/motoko-instrument.wasm b/tests/ok/motoko-instrument.wasm index de41072..97e8a73 100644 Binary files a/tests/ok/motoko-instrument.wasm and b/tests/ok/motoko-instrument.wasm differ diff --git a/tests/ok/motoko-region-instrument.wasm b/tests/ok/motoko-region-instrument.wasm index d1a8bab..b045cde 100644 Binary files a/tests/ok/motoko-region-instrument.wasm and b/tests/ok/motoko-region-instrument.wasm differ diff --git a/tests/ok/rust-instrument.wasm b/tests/ok/rust-instrument.wasm index e1b5ee5..a557331 100644 Binary files a/tests/ok/rust-instrument.wasm and b/tests/ok/rust-instrument.wasm differ diff --git a/tests/ok/rust-region-instrument.wasm b/tests/ok/rust-region-instrument.wasm index f5f8f3d..33a5fb1 100644 Binary files a/tests/ok/rust-region-instrument.wasm and b/tests/ok/rust-region-instrument.wasm differ diff --git a/tests/ok/wat-instrument.wasm b/tests/ok/wat-instrument.wasm index 2c21354..5c78bb3 100644 Binary files a/tests/ok/wat-instrument.wasm and b/tests/ok/wat-instrument.wasm differ