(config: &mut Config)
| 433 | |
| 434 | #[wasmtime_test(wasm_features(exceptions))] |
| 435 | fn store_pending_exnref_has_write_barrier(config: &mut Config) -> wasmtime::Result<()> { |
| 436 | config.collector(Collector::DeferredReferenceCounting); |
| 437 | let engine = Engine::new(&config)?; |
| 438 | let mut store = Store::new(&engine, ()); |
| 439 | |
| 440 | let functy = FuncType::new(&engine, [ValType::EXTERNREF], []); |
| 441 | let tagty = TagType::new(functy); |
| 442 | let tag = Tag::new(&mut store, &tagty)?; |
| 443 | let exnty = ExnType::from_tag_type(&tagty)?; |
| 444 | let exnpre = ExnRefPre::new(&mut store, exnty); |
| 445 | |
| 446 | let dropped = Arc::new(AtomicBool::new(false)); |
| 447 | |
| 448 | eprintln!("a1"); |
| 449 | |
| 450 | { |
| 451 | let mut scope = RootScope::new(&mut store); |
| 452 | let r = ExternRef::new(&mut scope, SetFlagOnDrop(dropped.clone()))?; |
| 453 | let exn1 = ExnRef::new(&mut scope, &exnpre, &tag, &[Val::ExternRef(Some(r))])?; |
| 454 | let _ = scope.as_context_mut().throw::<()>(exn1); |
| 455 | } |
| 456 | eprintln!("a2"); |
| 457 | |
| 458 | store.gc(None)?; |
| 459 | eprintln!("a5"); |
| 460 | assert!(!dropped.load(Relaxed)); |
| 461 | |
| 462 | { |
| 463 | let mut scope = RootScope::new(&mut store); |
| 464 | let exn2 = ExnRef::new(&mut scope, &exnpre, &tag, &[Val::ExternRef(None)])?; |
| 465 | let _ = scope.as_context_mut().throw::<()>(exn2); |
| 466 | } |
| 467 | eprintln!("a3"); |
| 468 | |
| 469 | store.gc(None)?; |
| 470 | eprintln!("a4"); |
| 471 | assert!(dropped.load(Relaxed)); |
| 472 | |
| 473 | Ok(()) |
| 474 | } |
nothing calls this directly
no test coverage detected