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

Function rename

cranelift/interpreter/src/frame.rs:217–231  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215 #[test]
216 #[should_panic(expected = "empty slot: v10")]
217 fn rename() {
218 let func = function("function %test(i32) -> i32 { block0(v10:i32): return v10 }");
219 let mut frame = Frame::new(&func);
220 let old_ssa_value_refs = [ValueRef::from_u32(9), ValueRef::from_u32(10)];
221 let values = vec![DataValue::I8(1), DataValue::F64(Ieee64::from(0.0))];
222 frame.set_all(&old_ssa_value_refs, values.clone());
223
224 // Rename the old SSA values to the new values.
225 let new_ssa_value_refs = [ValueRef::from_u32(4), ValueRef::from_u32(2)];
226 frame.rename(&old_ssa_value_refs, &new_ssa_value_refs);
227
228 // Now we should be able to retrieve new values and the old ones should fail.
229 assert_eq!(frame.get_all(&new_ssa_value_refs), values);
230 frame.get(ValueRef::from_u32(10));
231 }
232
233 #[test]
234 #[should_panic(expected = "empty slot: v2")]

Callers 1

fs_write_atomicFunction · 0.85

Calls 6

functionFunction · 0.85
set_allMethod · 0.80
newFunction · 0.50
cloneMethod · 0.45
renameMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected