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

Method handle_unreachable_else

winch/codegen/src/codegen/mod.rs:279–294  ·  view source on GitHub ↗

The following two helpers, handle else or end instructions when the compiler has entered into an unreachable code state. These instructions must be observed to determine if the reachability state should be restored. When the compiler is in an unreachable state, all the other instructions are not visited.

(&mut self)

Source from the content-addressed store, hash-verified

277 /// When the compiler is in an unreachable state, all the other instructions
278 /// are not visited.
279 pub fn handle_unreachable_else(&mut self) -> Result<()> {
280 let frame = self
281 .control_frames
282 .last_mut()
283 .ok_or_else(|| CodeGenError::control_frame_expected())?;
284 ensure!(frame.is_if(), CodeGenError::if_control_frame_expected());
285 if frame.is_next_sequence_reachable() {
286 // We entered an unreachable state when compiling the
287 // if-then branch, but if the `if` was reachable at
288 // entry, the if-else branch will be reachable.
289 self.context.reachable = true;
290 frame.ensure_stack_state(self.masm, &mut self.context)?;
291 frame.bind_else(self.masm, &mut self.context)?;
292 }
293 Ok(())
294 }
295
296 pub fn handle_unreachable_end(&mut self) -> Result<()> {
297 let mut frame = self.pop_control_frame()?;

Callers 1

visit_elseMethod · 0.80

Calls 5

OkFunction · 0.85
ensure_stack_stateMethod · 0.80
bind_elseMethod · 0.80
last_mutMethod · 0.45

Tested by

no test coverage detected