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

Method test_value

crates/fuzzing/src/generators/exception_ops.rs:71–80  ·  view source on GitHub ↗

A deterministic "interesting" constant for the given type and index, used as the thrown payload so the oracle can verify the catch.

(self, idx: u32)

Source from the content-addressed store, hash-verified

69 /// A deterministic "interesting" constant for the given type and index,
70 /// used as the thrown payload so the oracle can verify the catch.
71 fn test_value(self, idx: u32) -> Instruction<'static> {
72 match self {
73 Self::I32 => Instruction::I32Const(0x1000_i32.wrapping_add(idx.cast_signed())),
74 Self::I64 => Instruction::I64Const(0x2000_i64.wrapping_add(i64::from(idx))),
75 Self::F32 => Instruction::F32Const(wasm_encoder::Ieee32::new(0x4000_0000 + idx)),
76 Self::F64 => Instruction::F64Const(wasm_encoder::Ieee64::new(
77 0x4000_0000_0000_0000 + u64::from(idx),
78 )),
79 }
80 }
81}
82
83/// Which kind of catch clause to use for the handler.

Callers 1

encodeMethod · 0.80

Calls 2

fromFunction · 0.85
newFunction · 0.50

Tested by

no test coverage detected