MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / exec_table_fill

Method exec_table_fill

crates/tinywasm/src/interpreter/executor.rs:1540–1557  ·  view source on GitHub ↗
(&mut self, table_index: u32)

Source from the content-addressed store, hash-verified

1538 }
1539
1540 fn exec_table_fill(&mut self, table_index: u32) -> Result<(), Trap> {
1541 let table = self.store.state.get_table_mut(self.module.resolve_table_addr(table_index));
1542
1543 let n = <i32>::stack_pop(&mut self.store.value_stack);
1544 let val = <ValueRef>::stack_pop(&mut self.store.value_stack);
1545 let i = <i32>::stack_pop(&mut self.store.value_stack);
1546
1547 if i + n > table.size() {
1548 cold_path();
1549 return Err(Trap::TableOutOfBounds { offset: i as usize, len: n as usize, max: table.size() as usize });
1550 }
1551
1552 if n == 0 {
1553 return Ok(());
1554 }
1555
1556 table.fill(self.module.func_addrs(), i as usize, n as usize, val.addr().into())
1557 }
1558}
1559
1560impl<'store> Executor<'store, false> {

Callers 1

execMethod · 0.80

Calls 6

get_table_mutMethod · 0.80
resolve_table_addrMethod · 0.80
func_addrsMethod · 0.80
sizeMethod · 0.45
fillMethod · 0.45
addrMethod · 0.45

Tested by

no test coverage detected