Skip to content

Commit dbf0b31

Browse files
committed
move ControlEffect
1 parent 79225d1 commit dbf0b31

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

crates/environ/src/stack_switching.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,3 @@ pub const CONTROL_EFFECT_SUSPEND_DISCRIMINANT: u32 = 2;
9797
/// Discriminant of variant `Switch` in
9898
/// `runtime::vm::stack_switching::ControlEffect`.
9999
pub const CONTROL_EFFECT_SWITCH_DISCRIMINANT: u32 = 3;
100-
101-
/// Universal control effect. This structure encodes return signal, resume
102-
/// signal, suspension signal, and the handler to suspend to in a single variant
103-
/// type. This instance is used at runtime. There is a codegen counterpart in
104-
/// `cranelift/src/stack-switching/control_effect.rs`.
105-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
106-
#[repr(u32)]
107-
pub enum ControlEffect {
108-
/// Used to signal that a continuation has returned and control switches
109-
/// back to the parent.
110-
Return = CONTROL_EFFECT_RETURN_DISCRIMINANT,
111-
/// Used to signal to a continuation that it is being resumed.
112-
Resume = CONTROL_EFFECT_RESUME_DISCRIMINANT,
113-
/// Used to signal that a continuation has invoked a `suspend` instruction.
114-
Suspend {
115-
/// The index of the handler to be used in the parent continuation to
116-
/// switch back to.
117-
handler_index: u32,
118-
} = CONTROL_EFFECT_SUSPEND_DISCRIMINANT,
119-
/// Used to signal that a continuation has invoked a `suspend` instruction.
120-
Switch = CONTROL_EFFECT_SWITCH_DISCRIMINANT,
121-
}

crates/wasmtime/src/runtime/vm/stack_switching.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,3 +681,27 @@ unsafe impl Sync for VMStackChainCell {}
681681

682682
/// FIXME(frank-emrich) Justify why this is safe
683683
unsafe impl crate::vm::VmSafe for VMStackChainCell {}
684+
685+
686+
/// Universal control effect. This structure encodes return signal, resume
687+
/// signal, suspension signal, and the handler to suspend to in a single variant
688+
/// type. This instance is used at runtime. There is a codegen counterpart in
689+
/// `cranelift/src/stack-switching/control_effect.rs`.
690+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
691+
#[repr(u32)]
692+
#[allow(dead_code)]
693+
pub enum ControlEffect {
694+
/// Used to signal that a continuation has returned and control switches
695+
/// back to the parent.
696+
Return = wasmtime_environ::stack_switching::CONTROL_EFFECT_RETURN_DISCRIMINANT,
697+
/// Used to signal to a continuation that it is being resumed.
698+
Resume = wasmtime_environ::stack_switching::CONTROL_EFFECT_RESUME_DISCRIMINANT,
699+
/// Used to signal that a continuation has invoked a `suspend` instruction.
700+
Suspend {
701+
/// The index of the handler to be used in the parent continuation to
702+
/// switch back to.
703+
handler_index: u32,
704+
} = wasmtime_environ::stack_switching::CONTROL_EFFECT_SUSPEND_DISCRIMINANT,
705+
/// Used to signal that a continuation has invoked a `suspend` instruction.
706+
Switch = wasmtime_environ::stack_switching::CONTROL_EFFECT_SWITCH_DISCRIMINANT,
707+
}

0 commit comments

Comments
 (0)