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

Function trap

pulley/tests/all/interp.rs:799–818  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

797
798#[test]
799fn trap() {
800 let mut vm = Vm::new().unwrap();
801 let dst = XReg::new(0).unwrap();
802
803 unsafe {
804 run(
805 &mut vm,
806 &[
807 Op::Xconst16(Xconst16 { dst, imm: 1 }),
808 Op::ExtendedOp(ExtendedOp::Trap(Trap {})),
809 Op::Xconst16(Xconst16 { dst, imm: 2 }),
810 Op::Ret(Ret {}),
811 ],
812 )
813 .unwrap_err();
814 }
815
816 // `dst` should not have been written to the second time.
817 assert_eq!(vm.state()[dst].get_u32(), 1);
818}

Callers

nothing calls this directly

Calls 4

runFunction · 0.70
newFunction · 0.50
TrapClass · 0.50
unwrapMethod · 0.45

Tested by

no test coverage detected