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

Function insert_stack_load

cranelift/fuzzgen/src/function_generator.rs:126–150  ·  view source on GitHub ↗
(
    fgen: &mut FunctionGenerator,
    builder: &mut FunctionBuilder,
    _opcode: Opcode,
    _args: &[Type],
    rets: &[Type],
)

Source from the content-addressed store, hash-verified

124}
125
126fn insert_stack_load(
127 fgen: &mut FunctionGenerator,
128 builder: &mut FunctionBuilder,
129 _opcode: Opcode,
130 _args: &[Type],
131 rets: &[Type],
132) -> Result<()> {
133 let typevar = rets[0];
134 let type_size = typevar.bytes();
135 let (slot, slot_size, _align, category) = fgen.stack_slot_with_size(type_size)?;
136
137 // `stack_load` doesn't support setting MemFlagsData, and it does not set any
138 // alias analysis bits, so we can only emit it for `Other` slots.
139 if category != AACategory::Other {
140 return Err(arbitrary::Error::IncorrectFormat.into());
141 }
142
143 let offset = fgen.u.int_in_range(0..=(slot_size - type_size))? as i32;
144
145 let val = builder.ins().stack_load(typevar, slot, offset);
146 let var = fgen.get_variable_of_type(typevar)?;
147 builder.def_var(var, val);
148
149 Ok(())
150}
151
152fn insert_stack_store(
153 fgen: &mut FunctionGenerator,

Callers

nothing calls this directly

Calls 6

OkFunction · 0.85
stack_slot_with_sizeMethod · 0.80
get_variable_of_typeMethod · 0.80
bytesMethod · 0.45
insMethod · 0.45
def_varMethod · 0.45

Tested by

no test coverage detected