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

Method ensure_ret_area

winch/codegen/src/codegen/control.rs:969–987  ·  view source on GitHub ↗

Ensures that there is enough space for return values on the stack. This function is called at the end of all blocks and when branching from within blocks.

(
        ret_area: &RetArea,
        context: &mut CodeGenContext<Emission>,
        masm: &mut M,
    )

Source from the content-addressed store, hash-verified

967 /// This function is called at the end of all blocks and when branching from
968 /// within blocks.
969 fn ensure_ret_area<M>(
970 ret_area: &RetArea,
971 context: &mut CodeGenContext<Emission>,
972 masm: &mut M,
973 ) -> Result<()>
974 where
975 M: MacroAssembler,
976 {
977 ensure!(ret_area.is_sp(), CodeGenError::sp_addressing_expected());
978 // Save any live registers and locals when exiting the block to ensure
979 // that the respective values are correctly located in memory.
980 // See [Self::adjust_stack_results] for more details.
981 context.spill(masm)?;
982 if ret_area.unwrap_sp() > masm.sp_offset()? {
983 masm.reserve_stack(ret_area.unwrap_sp().as_u32() - masm.sp_offset()?.as_u32())?
984 }
985
986 Ok(())
987 }
988
989 /// Loads the return pointer, if it exists, into the next available register.
990 fn maybe_load_retptr<M>(

Callers

nothing calls this directly

Calls 6

OkFunction · 0.85
spillMethod · 0.80
unwrap_spMethod · 0.80
sp_offsetMethod · 0.45
reserve_stackMethod · 0.45
as_u32Method · 0.45

Tested by

no test coverage detected