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

Method cast_from_pointer

crates/cranelift/src/compiler/component.rs:1979–1990  ·  view source on GitHub ↗

Helper to cast a host pointer integer type to the destination type.

(&mut self, val: ir::Value, is64: bool)

Source from the content-addressed store, hash-verified

1977
1978 // Helper to cast a host pointer integer type to the destination type.
1979 fn cast_from_pointer(&mut self, val: ir::Value, is64: bool) -> ir::Value {
1980 let host64 = self.isa.pointer_type() == ir::types::I64;
1981 if is64 == host64 {
1982 val
1983 } else if !is64 {
1984 assert!(host64);
1985 self.builder.ins().ireduce(ir::types::I32, val)
1986 } else {
1987 assert!(!host64);
1988 self.builder.ins().uextend(ir::types::I64, val)
1989 }
1990 }
1991
1992 fn load_runtime_memory_base(&mut self, vmctx: ir::Value, mem: RuntimeMemoryIndex) -> ir::Value {
1993 let pointer_type = self.isa.pointer_type();

Callers 1

translate_transcodeMethod · 0.80

Calls 2

pointer_typeMethod · 0.45
insMethod · 0.45

Tested by

no test coverage detected