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

Method emit_end

winch/codegen/src/codegen/control.rs:556–583  ·  view source on GitHub ↗

Handles the end of a control stack frame.

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

Source from the content-addressed store, hash-verified

554
555 /// Handles the end of a control stack frame.
556 pub fn emit_end<M: MacroAssembler>(
557 &mut self,
558 masm: &mut M,
559 context: &mut CodeGenContext<Emission>,
560 ) -> Result<()> {
561 use ControlStackFrame::*;
562 match self {
563 If { stack_state, .. } | Else { stack_state, .. } | Block { stack_state, .. } => {
564 ensure!(
565 stack_state.target_len == context.stack.len(),
566 CodeGenError::control_frame_state_mismatch()
567 );
568 // Before binding the exit label, we handle the block results.
569 self.pop_abi_results(context, masm, |results, _, _| {
570 Ok(results.ret_area().copied())
571 })?;
572 self.bind_end(masm, context)?;
573 }
574 Loop { stack_state, .. } => {
575 ensure!(
576 stack_state.target_len == context.stack.len(),
577 CodeGenError::control_frame_state_mismatch()
578 );
579 }
580 };
581
582 Ok(())
583 }
584
585 /// Binds the exit label of the current control stack frame and pushes the
586 /// ABI results to the value stack.

Callers 1

visit_endMethod · 0.45

Calls 5

OkFunction · 0.85
pop_abi_resultsMethod · 0.80
copiedMethod · 0.80
ret_areaMethod · 0.80
bind_endMethod · 0.80

Tested by

no test coverage detected