Retrieves the size of the memory, pushing the result to the value stack.
(&mut self, heap_data: &HeapData, size_reg: Reg)
| 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<()> { |
| 1510 | self.masm.with_scratch::<IntScratch, _>(|masm, scratch| { |
| 1511 | let base = if let Some(offset) = heap_data.import_from { |
| 1512 | masm.load_ptr(masm.address_at_vmctx(offset)?, scratch.writable())?; |
| 1513 | scratch.inner() |
| 1514 | } else { |
| 1515 | vmctx!(M) |
| 1516 | }; |
| 1517 | |
| 1518 | let size_addr = masm.address_at_reg(base, heap_data.current_length_offset)?; |
| 1519 | masm.load_ptr(size_addr, writable!(size_reg)) |
| 1520 | })?; |
| 1521 | Ok(()) |
| 1522 | } |
| 1523 | |
| 1524 | /// Retrieves the size of the memory, pushing the result to the value stack. |
| 1525 | pub fn emit_compute_memory_size(&mut self, heap_data: &HeapData) -> Result<()> { |
no test coverage detected