diff --git a/ci/download-wasmtime.py b/ci/download-wasmtime.py index bd8682ab..01ab44ae 100644 --- a/ci/download-wasmtime.py +++ b/ci/download-wasmtime.py @@ -10,7 +10,7 @@ import zipfile from pathlib import Path -WASMTIME_VERSION = "v15.0.0" +WASMTIME_VERSION = "v16.0.0" def main(platform, arch): diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 92566cad..38b5b678 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -29,15 +29,15 @@ dependencies = [ "wasmtime-environ", "wit-bindgen", "wit-bindgen-core", - "wit-component", + "wit-component 0.19.1", "wit-parser", ] [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "cfg-if" @@ -47,9 +47,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cranelift-entity" -version = "0.102.0" +version = "0.103.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f871ada808b58158d84dfc43a6a2e2d2756baaf4ed1c51fd969ca8330e6ca5c" +checksum = "44e3ee532fc4776c69bcedf7e62f9632cbb3f35776fa9a525cdade3195baa3f7" dependencies = [ "serde", "serde_derive", @@ -310,43 +310,29 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasi_snapshot_preview1" -version = "0.1.0" -dependencies = [ - "wasi", - "wit-bindgen", -] - [[package]] name = "wasm-encoder" -version = "0.36.2" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "822b645bf4f2446b949776ffca47e2af60b167209ffb70814ef8779d299cd421" +checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" dependencies = [ "leb128", ] [[package]] name = "wasm-encoder" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b09bc5df933a3dabbdb72ae4b6b71be8ae07f58774d5aa41bd20adcd41a235a" +checksum = "111495d6204760238512f57a9af162f45086504da332af210f2f75dd80b34f1d" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.10.13" +version = "0.10.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4a14bbedb07737809c00843d1f2f88ba0b8950c114283e0387e30b1b6ee558" +checksum = "818931c85b1d197909699d36c509fa89550ccfa0d66932ba3c1726faddb4d0c7" dependencies = [ "anyhow", "indexmap", @@ -354,15 +340,15 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.38.0", - "wasmparser 0.118.0", + "wasm-encoder 0.39.0", + "wasmparser 0.119.0", ] [[package]] name = "wasmparser" -version = "0.116.1" +version = "0.118.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" +checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" dependencies = [ "indexmap", "semver", @@ -370,35 +356,36 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.118.0" +version = "0.119.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebbb91574de0011ded32b14db12777e7dd5e9ea2f9d7317a1ab51a9495c75924" +checksum = "8c35daf77afb4f9b14016625144a391085ec2ca99ca9cc53ed291bb53ab5278d" dependencies = [ + "bitflags", "indexmap", "semver", ] [[package]] name = "wasmprinter" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a7a046e6636d25c06a5df00bdc34e02f9e6e0e8a356d738299b961a6126114" +checksum = "cac2a7745372074e5573e365e17100f5a26058740576313784ef03fb900ea8d2" dependencies = [ "anyhow", - "wasmparser 0.118.0", + "wasmparser 0.119.0", ] [[package]] name = "wasmtime-component-util" -version = "15.0.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e85f1319a7ed36aa59446ab7e967d0c2fb0cd179bf56913633190b44572023e" +checksum = "8c87d06c18d21a4818f354c00a85f4ebc62b2270961cd022968452b0e4dbed9d" [[package]] name = "wasmtime-environ" -version = "15.0.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0116108e7d231cce15fe7dd642c66c3abb14dbcf169b0130e11f223ce8d1ad7" +checksum = "61eb64fb3e0da883e2df4a13a81d6282e072336e6cb6295021d0f7ab2e352754" dependencies = [ "anyhow", "cranelift-entity", @@ -410,8 +397,8 @@ dependencies = [ "serde_derive", "target-lexicon", "thiserror", - "wasm-encoder 0.36.2", - "wasmparser 0.116.1", + "wasm-encoder 0.38.1", + "wasmparser 0.118.1", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -419,22 +406,22 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "15.0.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447973db3dc5c24db14130ab0922795c58790aec296d198ad9d253b82ec67471" +checksum = "d995db8bb56f2cd8d2dc0ed5ffab94ffb435283b0fe6747f80f7aab40b2d06a1" dependencies = [ "cranelift-entity", "serde", "serde_derive", "thiserror", - "wasmparser 0.116.1", + "wasmparser 0.118.1", ] [[package]] name = "wit-bindgen" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0205c6e67438f9d657318e0d7ee407a8017cd7bc5f1636cd4a280d4ccbc8d4a0" +checksum = "b76f1d099678b4f69402a421e888bbe71bf20320c2f3f3565d0e7484dbe5bc20" dependencies = [ "bitflags", "wit-bindgen-rust-macro", @@ -442,33 +429,33 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dfc34e539edf78da2efed167549962a4d26000db04694408285f52d90703fee" +checksum = "75d55e1a488af2981fb0edac80d8d20a51ac36897a1bdef4abde33c29c1b6d0d" dependencies = [ "anyhow", - "wit-component", + "wit-component 0.18.2", "wit-parser", ] [[package]] name = "wit-bindgen-rust" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e898ad170a2796e9ecc495ce52cc2518dc35364ec042a4e108dd3c454e2a24c6" +checksum = "a01ff9cae7bf5736750d94d91eb8a49f5e3a04aff1d1a3218287d9b2964510f8" dependencies = [ "anyhow", "heck", "wasm-metadata", "wit-bindgen-core", - "wit-component", + "wit-component 0.18.2", ] [[package]] name = "wit-bindgen-rust-macro" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde5bc98cd9ebc817e7a0325120b5cf047643c2cc4583b917e66914215f94cff" +checksum = "804a98e2538393d47aa7da65a7348116d6ff403b426665152b70a168c0146d49" dependencies = [ "anyhow", "proc-macro2", @@ -476,7 +463,7 @@ dependencies = [ "syn", "wit-bindgen-core", "wit-bindgen-rust", - "wit-component", + "wit-component 0.18.2", ] [[package]] @@ -492,17 +479,36 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.38.0", + "wasm-encoder 0.38.1", + "wasm-metadata", + "wasmparser 0.118.1", + "wit-parser", +] + +[[package]] +name = "wit-component" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "429e3c06fba3a7566aab724ae3ffff3152ede5399d44789e7dd11f5421292859" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder 0.39.0", "wasm-metadata", - "wasmparser 0.118.0", + "wasmparser 0.119.0", "wit-parser", ] [[package]] name = "wit-parser" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15df6b7b28ce94b8be39d8df5cb21a08a4f3b9f33b631aedb4aa5776f785ead3" +checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" dependencies = [ "anyhow", "id-arena", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index de246035..aef9f783 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,10 +1,10 @@ [workspace] -members = ['bindgen', 'wasi_snapshot_preview1'] +members = ['bindgen'] resolver = "2" [workspace.dependencies] -wit-bindgen = { version = "0.14.0", default-features = false, features = ['macros'] } -wit-bindgen-core = "0.14.0" +wit-bindgen = { version = "0.16.0", default-features = false, features = ['macros'] } +wit-bindgen-core = "0.16.0" [profile.release] strip = 'debuginfo' diff --git a/rust/bindgen/Cargo.toml b/rust/bindgen/Cargo.toml index 2c6a990a..94b81f8b 100644 --- a/rust/bindgen/Cargo.toml +++ b/rust/bindgen/Cargo.toml @@ -11,10 +11,10 @@ crate-type = ['cdylib', 'rlib'] [dependencies] anyhow = "1.0" heck = { version = "0.4", features = ["unicode"] } -wit-parser = "0.13.0" -wit-component = "0.18.0" +wit-parser = "0.13.1" +wit-component = "0.19.1" indexmap = "2.0" -wasmtime-environ = { version = "15.0.0", features = ['component-model'] } +wasmtime-environ = { version = "16.0.0", features = ['component-model'] } wit-bindgen = { workspace = true, features = ['default'] } wit-bindgen-core = { workspace = true } diff --git a/rust/wasi_snapshot_preview1/Cargo.toml b/rust/wasi_snapshot_preview1/Cargo.toml deleted file mode 100644 index daa4e9cd..00000000 --- a/rust/wasi_snapshot_preview1/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "wasi_snapshot_preview1" -version = "0.1.0" -edition = "2021" -publish = false - -[lib] -crate-type = ['cdylib'] - -[dependencies] -wasi = "0.11.0" -wit-bindgen = { workspace = true, default-features = false, features = ['macros'] } diff --git a/rust/wasi_snapshot_preview1/src/lib.rs b/rust/wasi_snapshot_preview1/src/lib.rs deleted file mode 100644 index 0ed471a7..00000000 --- a/rust/wasi_snapshot_preview1/src/lib.rs +++ /dev/null @@ -1,72 +0,0 @@ -use std::arch::wasm32::unreachable; -use wasi::*; - -wit_bindgen::generate!("python" in "../python.wit"); - -#[no_mangle] -pub extern "C" fn environ_get(environ: *mut *mut u8, environ_buf: *mut u8) -> Errno { - drop((environ, environ_buf)); - ERRNO_SUCCESS -} - -#[no_mangle] -pub extern "C" fn environ_sizes_get(environc: *mut Size, environ_buf_size: *mut Size) -> Errno { - unsafe { - *environc = 0; - *environ_buf_size = 0; - } - ERRNO_SUCCESS -} - -#[no_mangle] -pub extern "C" fn fd_write( - fd: Fd, - mut iovs_ptr: *const Ciovec, - mut iovs_len: usize, - nwritten: *mut Size, -) -> Errno { - if fd != 1 && fd != 2 { - unreachable(); - } - unsafe { - // Advance to the first non-empty buffer. - while iovs_len != 0 && (*iovs_ptr).buf_len == 0 { - iovs_ptr = iovs_ptr.add(1); - iovs_len -= 1; - } - if iovs_len == 0 { - *nwritten = 0; - return ERRNO_SUCCESS; - } - - let ptr = (*iovs_ptr).buf; - let len = (*iovs_ptr).buf_len; - - let slice = core::slice::from_raw_parts(ptr, len); - if fd == 1 { - python::print(slice); - } else { - python::eprint(slice); - } - - *nwritten = len; - } - ERRNO_SUCCESS -} - -// Not exactly random but this is just a placeholder until there's a more -// official preview1 adapter. -#[no_mangle] -pub unsafe extern "C" fn random_get(buf: *mut u8, buf_len: Size) -> Errno { - for i in 0..buf_len { - *buf.add(i) = 1; - } - - ERRNO_SUCCESS -} - -#[no_mangle] -pub extern "C" fn proc_exit(rval: Exitcode) -> ! { - drop(rval); - unreachable() // TODO -} diff --git a/setup.py b/setup.py index f7486a46..a95d3859 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as fh: long_description = fh.read() -version = "15.0.0" +version = "16.0.0" # Give unique version numbers to all commits so our publication-on-each commit # works on main diff --git a/wasmtime/_bindings.py b/wasmtime/_bindings.py index 6c1a4d1b..68416164 100644 --- a/wasmtime/_bindings.py +++ b/wasmtime/_bindings.py @@ -2180,6 +2180,12 @@ def wasmtime_config_cranelift_flag_enable(arg0: Any, arg1: Any) -> None: def wasmtime_config_cranelift_flag_set(arg0: Any, key: Any, value: Any) -> None: return _wasmtime_config_cranelift_flag_set(arg0, key, value) # type: ignore +_wasmtime_config_macos_use_mach_ports_set = dll.wasmtime_config_macos_use_mach_ports_set +_wasmtime_config_macos_use_mach_ports_set.restype = None +_wasmtime_config_macos_use_mach_ports_set.argtypes = [POINTER(wasm_config_t), c_bool] +def wasmtime_config_macos_use_mach_ports_set(arg0: Any, arg1: Any) -> None: + return _wasmtime_config_macos_use_mach_ports_set(arg0, arg1) # type: ignore + wasmtime_memory_get_callback_t = CFUNCTYPE(c_size_t, c_void_p, POINTER(c_size_t), POINTER(c_size_t)) wasmtime_memory_grow_callback_t = CFUNCTYPE(c_size_t, c_void_p, c_size_t) @@ -2371,11 +2377,13 @@ def wasmtime_context_set_wasi(context: Any, wasi: Any) -> ctypes._Pointer: def wasmtime_context_set_epoch_deadline(context: Any, ticks_beyond_current: Any) -> None: return _wasmtime_context_set_epoch_deadline(context, ticks_beyond_current) # type: ignore +wasmtime_update_deadline_kind_t = c_uint8 + _wasmtime_store_epoch_deadline_callback = dll.wasmtime_store_epoch_deadline_callback _wasmtime_store_epoch_deadline_callback.restype = None -_wasmtime_store_epoch_deadline_callback.argtypes = [POINTER(wasmtime_store_t), CFUNCTYPE(c_size_t, POINTER(wasmtime_context_t), c_void_p, POINTER(c_uint64)), c_void_p] -def wasmtime_store_epoch_deadline_callback(store: Any, func: Any, data: Any) -> None: - return _wasmtime_store_epoch_deadline_callback(store, func, data) # type: ignore +_wasmtime_store_epoch_deadline_callback.argtypes = [POINTER(wasmtime_store_t), CFUNCTYPE(c_size_t, POINTER(wasmtime_context_t), c_void_p, POINTER(c_uint64), POINTER(wasmtime_update_deadline_kind_t)), c_void_p, CFUNCTYPE(None, c_void_p)] +def wasmtime_store_epoch_deadline_callback(store: Any, func: Any, data: Any, finalizer: Any) -> None: + return _wasmtime_store_epoch_deadline_callback(store, func, data, finalizer) # type: ignore class wasmtime_func(Structure): _fields_ = [ @@ -2685,8 +2693,8 @@ class wasmtime_instance_pre(Structure): _wasmtime_instance_pre_delete = dll.wasmtime_instance_pre_delete _wasmtime_instance_pre_delete.restype = None _wasmtime_instance_pre_delete.argtypes = [POINTER(wasmtime_instance_pre_t)] -def wasmtime_instance_pre_delete(instance: Any) -> None: - return _wasmtime_instance_pre_delete(instance) # type: ignore +def wasmtime_instance_pre_delete(instance_pre: Any) -> None: + return _wasmtime_instance_pre_delete(instance_pre) # type: ignore _wasmtime_instance_pre_instantiate = dll.wasmtime_instance_pre_instantiate _wasmtime_instance_pre_instantiate.restype = POINTER(wasmtime_error_t) @@ -2694,6 +2702,12 @@ def wasmtime_instance_pre_delete(instance: Any) -> None: def wasmtime_instance_pre_instantiate(instance_pre: Any, store: Any, instance: Any, trap_ptr: Any) -> ctypes._Pointer: return _wasmtime_instance_pre_instantiate(instance_pre, store, instance, trap_ptr) # type: ignore +_wasmtime_instance_pre_module = dll.wasmtime_instance_pre_module +_wasmtime_instance_pre_module.restype = POINTER(wasmtime_module_t) +_wasmtime_instance_pre_module.argtypes = [POINTER(wasmtime_instance_pre_t)] +def wasmtime_instance_pre_module(instance_pre: Any) -> ctypes._Pointer: + return _wasmtime_instance_pre_module(instance_pre) # type: ignore + class wasmtime_linker(Structure): pass