From 688cf64faba9c2420829cfbe94c0835c097c507c Mon Sep 17 00:00:00 2001 From: Maksim Bondarenkov Date: Mon, 7 Oct 2024 21:31:11 +0300 Subject: [PATCH] deps: Update corosensei --- Cargo.lock | 53 ++++----------------------------- lib/vm/Cargo.toml | 2 +- lib/vm/src/instance/mod.rs | 2 +- lib/vm/src/trap/traphandlers.rs | 12 ++++---- 4 files changed, 13 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 92fb5824eec..37eb79083ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,15 +790,15 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "corosensei" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e" +checksum = "9df377b6fe112194ef58438f509c904ecb363ea89ed23b85c8abe8d2bc06df89" dependencies = [ "autocfg", "cfg-if 1.0.0", "libc", "scopeguard", - "windows-sys 0.33.0", + "windows-sys 0.59.0", ] [[package]] @@ -2707,9 +2707,9 @@ dependencies = [ [[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 = "libfuzzer-sys" @@ -7512,19 +7512,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" -dependencies = [ - "windows_aarch64_msvc 0.33.0", - "windows_i686_gnu 0.33.0", - "windows_i686_msvc 0.33.0", - "windows_x86_64_gnu 0.33.0", - "windows_x86_64_msvc 0.33.0", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -7595,12 +7582,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7613,12 +7594,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7637,12 +7612,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7655,12 +7624,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7685,12 +7648,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index 1207138da14..5e34c85d4ec 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -27,7 +27,7 @@ enum-iterator = "0.7.0" scopeguard = "1.1.0" lazy_static = "1.4.0" region = { version = "3.0.2" } -corosensei = { version = "0.1.2" } +corosensei = { version = "0.2.0" } derivative = { version = "^2" } fnv = "1.0.3" # - Optional shared dependencies. diff --git a/lib/vm/src/instance/mod.rs b/lib/vm/src/instance/mod.rs index fa61069f0d3..4e80880df9a 100644 --- a/lib/vm/src/instance/mod.rs +++ b/lib/vm/src/instance/mod.rs @@ -357,7 +357,7 @@ impl Instance { // Make the call. unsafe { - catch_traps(trap_handler, config, || { + catch_traps(trap_handler, config, move || { mem::transmute::<*const VMFunctionBody, unsafe extern "C" fn(VMFunctionContext)>( callee_address, )(callee_vmctx) diff --git a/lib/vm/src/trap/traphandlers.rs b/lib/vm/src/trap/traphandlers.rs index 4ce892db0a0..5c86df82c2e 100644 --- a/lib/vm/src/trap/traphandlers.rs +++ b/lib/vm/src/trap/traphandlers.rs @@ -10,7 +10,7 @@ use backtrace::Backtrace; use core::ptr::{read, read_unaligned}; use corosensei::stack::DefaultStack; use corosensei::trap::{CoroutineTrapHandler, TrapHandlerRegs}; -use corosensei::{CoroutineResult, ScopedCoroutine, Yielder}; +use corosensei::{Coroutine, CoroutineResult, Yielder}; use scopeguard::defer; use std::any::Any; use std::cell::Cell; @@ -672,7 +672,7 @@ pub unsafe fn wasmer_call_trampoline( callee: *const VMFunctionBody, values_vec: *mut u8, ) -> Result<(), Trap> { - catch_traps(trap_handler, config, || { + catch_traps(trap_handler, config, move || { mem::transmute::<_, extern "C" fn(VMFunctionContext, *const VMFunctionBody, *mut u8)>( trampoline, )(vmctx, callee, values_vec); @@ -685,13 +685,13 @@ pub unsafe fn wasmer_call_trampoline( /// # Safety /// /// Highly unsafe since `closure` won't have any dtors run. -pub unsafe fn catch_traps( +pub unsafe fn catch_traps( trap_handler: Option<*const TrapHandlerFn<'static>>, config: &VMConfig, closure: F, ) -> Result where - F: FnOnce() -> R, + F: FnOnce() -> R + 'static, { // Ensure that per-thread initialization is done. lazy_per_thread_init()?; @@ -914,7 +914,7 @@ unsafe fn unwind_with(reason: UnwindReason) -> ! { /// Runs the given function on a separate stack so that its stack usage can be /// bounded. Stack overflows and other traps can be caught and execution /// returned to the root of the stack. -fn on_wasm_stack T, T>( +fn on_wasm_stack T + 'static, T: 'static>( stack_size: usize, trap_handler: Option<*const TrapHandlerFn<'static>>, f: F, @@ -932,7 +932,7 @@ fn on_wasm_stack T, T>( let mut stack = scopeguard::guard(stack, |stack| STACK_POOL.push(stack)); // Create a coroutine with a new stack to run the function on. - let mut coro = ScopedCoroutine::with_stack(&mut *stack, move |yielder, ()| { + let mut coro = Coroutine::with_stack(&mut *stack, move |yielder, ()| { // Save the yielder to TLS so that it can be used later. YIELDER.with(|cell| cell.set(Some(yielder.into())));