| 218 | #[wasmtime_test(wasm_features(gc, exceptions))] |
| 219 | #[cfg_attr(miri, ignore)] |
| 220 | fn gc_with_exnref_global(config: &mut Config) -> Result<()> { |
| 221 | let engine = Engine::new(config)?; |
| 222 | let mut store = Store::new(&engine, ()); |
| 223 | |
| 224 | let module = Module::new( |
| 225 | &engine, |
| 226 | r#" |
| 227 | (module |
| 228 | (global (export "g") (mut exnref) (ref.null exn))) |
| 229 | "#, |
| 230 | )?; |
| 231 | |
| 232 | let instance = Instance::new(&mut store, &module, &[])?; |
| 233 | |
| 234 | let functy = FuncType::new(&engine, [], []); |
| 235 | let tagty = TagType::new(functy.clone()); |
| 236 | let exnty = ExnType::from_tag_type(&tagty).unwrap(); |
| 237 | let exnpre = ExnRefPre::new(&mut store, exnty); |
| 238 | let tag = Tag::new(&mut store, &tagty)?; |
| 239 | let exn = ExnRef::new(&mut store, &exnpre, &tag, &[])?; |
| 240 | |
| 241 | let global = instance.get_global(&mut store, "g").unwrap(); |
| 242 | global.set(&mut store, Val::ExnRef(Some(exn)))?; |
| 243 | |
| 244 | store.gc(None)?; |
| 245 | |
| 246 | Ok(()) |
| 247 | } |
| 248 | |
| 249 | #[wasmtime_test(wasm_features(exceptions))] |
| 250 | #[cfg_attr(miri, ignore)] |