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

Function bad_instruction_format

cranelift/codegen/src/verifier/mod.rs:2190–2214  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2188
2189 #[test]
2190 fn bad_instruction_format() {
2191 let mut func = Function::new();
2192 let block0 = func.dfg.make_block();
2193 func.layout.append_block(block0);
2194 let nullary_with_bad_opcode = func.dfg.make_inst(InstructionData::UnaryImm {
2195 opcode: Opcode::F32const,
2196 imm: 0.into(),
2197 });
2198 func.layout.append_inst(nullary_with_bad_opcode, block0);
2199 let destination = func.dfg.block_call(block0, &[]);
2200 func.stencil.layout.append_inst(
2201 func.stencil.dfg.make_inst(InstructionData::Jump {
2202 opcode: Opcode::Jump,
2203 destination,
2204 }),
2205 block0,
2206 );
2207 let flags = &settings::Flags::new(settings::builder());
2208 let verifier = Verifier::new(&func, flags.into());
2209 let mut errors = VerifierErrors::default();
2210
2211 let _ = verifier.run(&mut errors);
2212
2213 assert_err_with_msg!(errors, "instruction format");
2214 }
2215
2216 fn test_iconst_bounds(immediate: i64, ctrl_typevar: Type) -> VerifierErrors {
2217 let mut func = Function::new();

Callers

nothing calls this directly

Calls 8

make_blockMethod · 0.80
append_blockMethod · 0.80
make_instMethod · 0.80
append_instMethod · 0.80
block_callMethod · 0.80
newFunction · 0.50
builderFunction · 0.50
runMethod · 0.45

Tested by

no test coverage detected