()
| 204 | #[test] |
| 205 | #[cfg_attr(miri, ignore)] |
| 206 | fn gc_access_during_call() -> wasmtime::Result<()> { |
| 207 | test_stack_values( |
| 208 | r#" |
| 209 | (module |
| 210 | (type $s (struct (field i32))) |
| 211 | (import "" "host" (func)) |
| 212 | (func (export "main") |
| 213 | (local $l (ref null $s)) |
| 214 | (local.set $l (struct.new $s (i32.const 42))) |
| 215 | (call 0))) |
| 216 | "#, |
| 217 | |config| { |
| 218 | config.wasm_gc(true); |
| 219 | }, |
| 220 | |mut caller: Caller<'_, ()>| { |
| 221 | let stack = caller.debug_exit_frames().next().unwrap(); |
| 222 | |
| 223 | // Do a GC while we hold the stack cursor. |
| 224 | caller.as_context_mut().gc(None).unwrap(); |
| 225 | |
| 226 | assert_eq!(stack.num_stacks(&mut caller)?, 0); |
| 227 | assert_eq!(stack.num_locals(&mut caller)?, 1); |
| 228 | // Note that this struct is dead during the call, and the |
| 229 | // ref could otherwise be optimized away (no longer in the |
| 230 | // stackmap at this point); but we verify it is still |
| 231 | // alive here because it is rooted in the |
| 232 | // debug-instrumentation slot. |
| 233 | let s = stack |
| 234 | .local(&mut caller, 0)? |
| 235 | .unwrap_any_ref() |
| 236 | .unwrap() |
| 237 | .unwrap_struct(&caller) |
| 238 | .unwrap(); |
| 239 | assert_eq!(s.field(&mut caller, 0).unwrap().unwrap_i32(), 42); |
| 240 | let stack = stack.parent(&mut caller)?; |
| 241 | assert!(stack.is_none()); |
| 242 | Ok(()) |
| 243 | }, |
| 244 | ) |
| 245 | } |
| 246 | |
| 247 | #[test] |
| 248 | #[cfg_attr(miri, ignore)] |
nothing calls this directly
no test coverage detected