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

Method insert

cranelift/codegen/src/ir/constant.rs:217–225  ·  view source on GitHub ↗

Insert constant data into the pool, returning a handle for later referencing; when constant data is inserted that is a duplicate of previous constant data, the existing handle will be returned.

(&mut self, constant_value: ConstantData)

Source from the content-addressed store, hash-verified

215 /// data is inserted that is a duplicate of previous constant data, the existing handle will be
216 /// returned.
217 pub fn insert(&mut self, constant_value: ConstantData) -> Constant {
218 if let Some(cst) = self.values_to_handles.get(&constant_value) {
219 return *cst;
220 }
221
222 let constant_handle = Constant::new(self.len());
223 self.set(constant_handle, constant_value);
224 constant_handle
225 }
226
227 /// Retrieve the constant data given a handle.
228 pub fn get(&self, constant_handle: Constant) -> &ConstantData {

Callers 7

from_strMethod · 0.45
setMethod · 0.45
insertFunction · 0.45
insert_duplicateFunction · 0.45
clearFunction · 0.45
iteration_orderFunction · 0.45
getFunction · 0.45

Calls 4

newFunction · 0.50
getMethod · 0.45
lenMethod · 0.45
setMethod · 0.45

Tested by 5

insertFunction · 0.36
insert_duplicateFunction · 0.36
clearFunction · 0.36
iteration_orderFunction · 0.36
getFunction · 0.36