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

Method emit_else

winch/codegen/src/codegen/control.rs:486–504  ·  view source on GitHub ↗

Handles the else branch if the current control stack frame is [`ControlStackFrame::If`].

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

Source from the content-addressed store, hash-verified

484 /// Handles the else branch if the current control stack frame is
485 /// [`ControlStackFrame::If`].
486 pub fn emit_else<M: MacroAssembler>(
487 &mut self,
488 masm: &mut M,
489 context: &mut CodeGenContext<Emission>,
490 ) -> Result<()> {
491 ensure!(self.is_if(), CodeGenError::if_control_frame_expected());
492 let state = self.stack_state();
493
494 ensure!(
495 state.target_len == context.stack.len(),
496 CodeGenError::control_frame_state_mismatch()
497 );
498 self.pop_abi_results(context, masm, |results, _, _| {
499 Ok(results.ret_area().copied())
500 })?;
501 masm.jmp(*self.exit_label().unwrap())?;
502 self.bind_else(masm, context)?;
503 Ok(())
504 }
505
506 /// Binds the else branch label and converts `self` to
507 /// [`ControlStackFrame::Else`].

Callers 1

visit_elseMethod · 0.80

Calls 9

OkFunction · 0.85
stack_stateMethod · 0.80
pop_abi_resultsMethod · 0.80
copiedMethod · 0.80
ret_areaMethod · 0.80
exit_labelMethod · 0.80
bind_elseMethod · 0.80
jmpMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected