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

Method rename

cranelift/interpreter/src/frame.rs:87–97  ·  view source on GitHub ↗

Rename all of the SSA references in `old_names` to those in `new_names`. This will remove any old references that are not in `old_names`. TODO This performs an extra allocation that could be removed if we copied the values in the right order (i.e. when modifying in place, we need to avoid changing a value before it is referenced).

(&mut self, old_names: &[ValueRef], new_names: &[ValueRef])

Source from the content-addressed store, hash-verified

85 /// could be removed if we copied the values in the right order (i.e. when modifying in place,
86 /// we need to avoid changing a value before it is referenced).
87 pub fn rename(&mut self, old_names: &[ValueRef], new_names: &[ValueRef]) {
88 trace!("Renaming {old_names:?} -> {new_names:?}");
89 assert_eq!(old_names.len(), new_names.len());
90 let new_registers = vec![None; self.registers.len()];
91 let mut old_registers = std::mem::replace(&mut self.registers, new_registers);
92 self.registers = vec![None; self.registers.len()];
93 for (&on, &nn) in old_names.iter().zip(new_names) {
94 let value = std::mem::replace(&mut old_registers[on.index()], None);
95 self.registers[nn.index()] = value;
96 }
97 }
98
99 /// Accessor for the current entries in the frame.
100 pub fn entries_mut(&mut self) -> &mut [Option<DataValue>] {

Callers 2

renameFunction · 0.45

Calls 3

replaceFunction · 0.50
iterMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected