| 1112 | #[test] |
| 1113 | #[cfg_attr(miri, ignore)] |
| 1114 | fn issue_9669() -> Result<()> { |
| 1115 | let _ = env_logger::try_init(); |
| 1116 | |
| 1117 | let mut config = Config::new(); |
| 1118 | config.wasm_function_references(true); |
| 1119 | config.wasm_gc(true); |
| 1120 | config.collector(Collector::DeferredReferenceCounting); |
| 1121 | |
| 1122 | let engine = Engine::new(&config)?; |
| 1123 | |
| 1124 | let module = Module::new( |
| 1125 | &engine, |
| 1126 | r#" |
| 1127 | (module |
| 1128 | (type $empty (struct)) |
| 1129 | (type $thing (struct |
| 1130 | (field $field1 (ref $empty)) |
| 1131 | (field $field2 (ref $empty)) |
| 1132 | )) |
| 1133 | |
| 1134 | (func (export "run") |
| 1135 | (local $object (ref $thing)) |
| 1136 | |
| 1137 | struct.new $empty |
| 1138 | struct.new $empty |
| 1139 | struct.new $thing |
| 1140 | |
| 1141 | local.tee $object |
| 1142 | struct.get $thing $field1 |
| 1143 | drop |
| 1144 | |
| 1145 | local.get $object |
| 1146 | struct.get $thing $field2 |
| 1147 | drop |
| 1148 | ) |
| 1149 | ) |
| 1150 | "#, |
| 1151 | )?; |
| 1152 | |
| 1153 | let mut store = Store::new(&engine, ()); |
| 1154 | let instance = Instance::new(&mut store, &module, &[])?; |
| 1155 | |
| 1156 | let func = instance.get_typed_func::<(), ()>(&mut store, "run")?; |
| 1157 | func.call(&mut store, ())?; |
| 1158 | |
| 1159 | Ok(()) |
| 1160 | } |
| 1161 | |
| 1162 | #[test] |
| 1163 | #[cfg_attr(miri, ignore)] |