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

Method emit_get_global_addr

winch/codegen/src/codegen/mod.rs:558–569  ·  view source on GitHub ↗

Loads the address of the given global.

(&mut self, index: GlobalIndex)

Source from the content-addressed store, hash-verified

556
557 /// Loads the address of the given global.
558 pub fn emit_get_global_addr(&mut self, index: GlobalIndex) -> Result<(WasmValType, Reg, u32)> {
559 let data = self.env.resolve_global(index);
560
561 if data.imported {
562 let global_base = self.masm.address_at_reg(vmctx!(M), data.offset)?;
563 let dst = self.context.any_gpr(self.masm)?;
564 self.masm.load_ptr(global_base, writable!(dst))?;
565 Ok((data.ty, dst, 0))
566 } else {
567 Ok((data.ty, vmctx!(M), data.offset))
568 }
569 }
570
571 pub fn emit_table_get(&mut self, table_index: TableIndex) -> Result<()> {
572 let table = self.env.table(table_index);

Callers 2

visit_global_getMethod · 0.80
visit_global_setMethod · 0.80

Calls 5

OkFunction · 0.85
resolve_globalMethod · 0.80
any_gprMethod · 0.80
address_at_regMethod · 0.45
load_ptrMethod · 0.45

Tested by

no test coverage detected