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

Method set

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

Link a constant handle to its value. This does not de-duplicate data but does avoid replacing any existing constant values. use `set` to tie a specific `const42` to its value; use `insert` to add a value and return the next available `const` entity.

(&mut self, constant_handle: Constant, constant_value: ConstantData)

Source from the content-addressed store, hash-verified

234 /// replacing any existing constant values. use `set` to tie a specific `const42` to its value;
235 /// use `insert` to add a value and return the next available `const` entity.
236 pub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData) {
237 let replaced = self
238 .handles_to_values
239 .insert(constant_handle, constant_value.clone());
240 assert!(
241 replaced.is_none(),
242 "attempted to overwrite an existing constant {:?}: {:?} => {:?}",
243 constant_handle,
244 &constant_value,
245 replaced.unwrap()
246 );
247 self.values_to_handles
248 .insert(constant_value, constant_handle);
249 }
250
251 /// Iterate over the constants in insertion order.
252 pub fn iter(&self) -> impl Iterator<Item = (&Constant, &ConstantData)> {

Callers 5

monotonic_instantFunction · 0.45
inline_oneFunction · 0.45
insertMethod · 0.45
setFunction · 0.45

Calls 2

insertMethod · 0.45
cloneMethod · 0.45

Tested by 1

setFunction · 0.36