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

Function assemble

cranelift/assembler-x64/src/fuzz.rs:49–54  ·  view source on GitHub ↗

Use this assembler to emit machine code into a byte buffer. This will skip any traps or label registrations, but this is fine for the single-instruction disassembly we're doing here.

(inst: &Inst<FuzzRegs>)

Source from the content-addressed store, hash-verified

47/// This will skip any traps or label registrations, but this is fine for the
48/// single-instruction disassembly we're doing here.
49fn assemble(inst: &Inst<FuzzRegs>) -> Vec<u8> {
50 let mut sink = TestCodeSink::default();
51 inst.encode(&mut sink);
52 sink.patch_labels_as_if_they_referred_to_end();
53 sink.buf
54}
55
56#[derive(Default)]
57struct TestCodeSink {

Callers 1

roundtripFunction · 0.85

Calls 2

encodeMethod · 0.45

Tested by

no test coverage detected