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

Method new_zeroed

cranelift/jit/src/compiled_blob.rs:67–89  ·  view source on GitHub ↗
(
        memory: &mut dyn JITMemoryProvider,
        size: usize,
        align: u64,
        relocs: Vec<ModuleReloc>,
        #[cfg(feature = "wasmtime-unwinder")] wasmtime_exception_data: Option<V

Source from the content-addressed store, hash-verified

65 }
66
67 pub(crate) fn new_zeroed(
68 memory: &mut dyn JITMemoryProvider,
69 size: usize,
70 align: u64,
71 relocs: Vec<ModuleReloc>,
72 #[cfg(feature = "wasmtime-unwinder")] wasmtime_exception_data: Option<Vec<u8>>,
73 kind: JITMemoryKind,
74 ) -> ModuleResult<Self> {
75 let ptr = memory
76 .allocate(size, align, kind)
77 .map_err(|e| ModuleError::Allocation { err: e })?;
78
79 unsafe { ptr::write_bytes(ptr, 0, size) };
80
81 Ok(CompiledBlob {
82 ptr,
83 size,
84 relocs,
85 veneer_count: 0,
86 #[cfg(feature = "wasmtime-unwinder")]
87 wasmtime_exception_data,
88 })
89 }
90
91 pub(crate) fn ptr(&self) -> *const u8 {
92 self.ptr

Callers

nothing calls this directly

Calls 3

write_bytesFunction · 0.85
OkFunction · 0.85
allocateMethod · 0.45

Tested by

no test coverage detected