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

Method emit_compute_table_size

winch/codegen/src/codegen/mod.rs:1487–1506  ·  view source on GitHub ↗

Retrieves the size of the table, pushing the result to the value stack.

(&mut self, table_data: &TableData)

Source from the content-addressed store, hash-verified

1485
1486 /// Retrieves the size of the table, pushing the result to the value stack.
1487 pub fn emit_compute_table_size(&mut self, table_data: &TableData) -> Result<()> {
1488 let size = self.context.any_gpr(self.masm)?;
1489 let ptr_size: OperandSize = self.env.ptr_type().try_into()?;
1490
1491 self.masm.with_scratch::<IntScratch, _>(|masm, scratch| {
1492 if let Some(offset) = table_data.import_from {
1493 masm.load_ptr(masm.address_at_vmctx(offset)?, scratch.writable())?;
1494 } else {
1495 masm.mov(scratch.writable(), vmctx!(M).into(), ptr_size)?;
1496 };
1497
1498 let size_addr =
1499 masm.address_at_reg(scratch.inner(), table_data.current_elems_offset)?;
1500 masm.load(size_addr, writable!(size), table_data.current_elements_size)
1501 })?;
1502
1503 let dst = TypedReg::new(table_data.index_type(), size);
1504 self.context.stack.push(dst.into());
1505 Ok(())
1506 }
1507
1508 /// Retrieves the size of the memory, pushing the result to the value stack.
1509 fn load_memory_length(&mut self, heap_data: &HeapData, size_reg: Reg) -> Result<()> {

Callers 4

visit_table_sizeMethod · 0.80
emit_table_fillMethod · 0.80
emit_table_initMethod · 0.80

Calls 14

OkFunction · 0.85
any_gprMethod · 0.80
newFunction · 0.50
try_intoMethod · 0.45
ptr_typeMethod · 0.45
load_ptrMethod · 0.45
address_at_vmctxMethod · 0.45
writableMethod · 0.45
movMethod · 0.45
address_at_regMethod · 0.45
innerMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected