MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / table_zeroed

Function table_zeroed

tests/all/pooling_allocator.rs:370–404  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

368
369#[test]
370fn table_zeroed() -> Result<()> {
371 if skip_pooling_allocator_tests() {
372 return Ok(());
373 }
374
375 let pool = crate::small_pool_config();
376 let mut config = Config::new();
377 config.allocation_strategy(pool);
378 config.memory_guard_size(0);
379 config.memory_reservation(1 << 16);
380
381 let engine = Engine::new(&config)?;
382
383 let module = Module::new(&engine, r#"(module (table (export "t") 10 funcref))"#)?;
384
385 // Instantiate the module repeatedly after filling table elements
386 for _ in 0..10 {
387 let mut store = Store::new(&engine, ());
388 let instance = Instance::new(&mut store, &module, &[])?;
389 let table = instance.get_table(&mut store, "t").unwrap();
390 let f = Func::wrap(&mut store, || {});
391
392 assert_eq!(table.size(&store), 10);
393
394 for i in 0..10 {
395 match table.get(&mut store, i).unwrap() {
396 Ref::Func(r) => assert!(r.is_none()),
397 _ => panic!("expected a funcref"),
398 }
399 table.set(&mut store, i, Ref::Func(Some(f))).unwrap();
400 }
401 }
402
403 Ok(())
404}
405
406#[test]
407fn total_core_instances_limit() -> Result<()> {

Callers

nothing calls this directly

Calls 12

OkFunction · 0.85
allocation_strategyMethod · 0.80
small_pool_configFunction · 0.70
newFunction · 0.50
FuncEnum · 0.50
memory_guard_sizeMethod · 0.45
memory_reservationMethod · 0.45
unwrapMethod · 0.45
get_tableMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected